[Toybox] weird timeout flake

enh enh at google.com
Tue Oct 3 11:38:14 PDT 2023


+Colin Cross who just saw this too.

On Wed, Aug 2, 2023 at 1:39 PM Rob Landley <rob at landley.net> wrote:
>
> On 8/2/23 11:04, enh via Toybox wrote:
> > i've not seen this myself, but i have _one_ report from CI of this failure:
> >
> > FAIL: timeout can't execute
> > echo -ne '' | "/system/bin/timeout" .1 / 2>/dev/null ; echo $?
> > --- expected 2023-06-21 04:02:52.424000000 +0000
> > +++ actual 2023-06-21 04:02:52.476000000 +0000
> > @@ -1 +1 @@
> > -126
> > +127
>
> Hmmm...
>
>   testcmd "can't execute" '.1 / 2>/dev/null ; echo $?' '126\n' '' ''
>
> Trying that by hand on devuan (using coreutils' timeout):
>
>   $ timeout .1 /
>   timeout: failed to run command ‘/’: Permission denied
>   $ echo $?
>   126
>
> From the bash man page:
>
>   If a command is not found, the child process created to execute it  re‐
>   turns  a  status  of 127.  If a command is found but is not executable,
>   the return status is 126.
>
> I'm not sure how you can "file not found" the root directory? (Selinux?
> Filehandle exhaustion? Even chmod 000 should return EPERM not ENOENT.)
>
> The relevant code is xwrap.c line 233:
>
>   execvp(argv[0], argv);
>
>   toys.exitval = 126+(errno == ENOENT);
>
> Rob
>
> P.S. Ok, TECHNICALLY there's also an _exit(127); on line 312, but that codepath
> only triggers when both A) argv is NULL (fork self), and B) you're on a nommu
> system when /proc/self/exe can't exec. We're not CALLING xpopen_setup() with a
> NULL argv (it's "/" here which is taken as an absolute path to the file to
> open), so even if you did somehow enable nommu support (either the compile time
> probe doesn't find fork() or you switch on TOYBOX_FORCE_NOMMU in menuconfig's
> global settings menu) that still shouldn't trigger.


More information about the Toybox mailing list