hush problem with the exec command

Martinb_ARM_NOMMU_KISSDVD martinb at zeelandnet.nl
Thu Mar 20 22:52:57 UTC 2008


@paul
the file I try to execute is a other script

the first line is (of the st508_rc2b):

#!/bin/hush

if I execute the script from telnet it does run without a problem

the reason I do start with this line is because i'm debugging some DVD
firmware and this way I can change the "testing hush" to /hdd/test1/hush (on
my old environment the /bin/sh was pointing to lash)

@vda
I always do test on i386 and it does run without any problem on i386. its
(like always) related to toolchain/nommu or something like that
sorry I did not mention this

1- its a script
2- this test does work
(so it does work on binfiles, it fail on scripts)
3- its the exact same config as the last i did send you
4- yes it does work on i386

@paul
thanks for you hint
it look you are (at some point) correct but its still strange
if I change the 2e script to a few lines it does work

but it still fail if I try to start my original "long" script

hmm, I’m getting insane
if I test the 2e script from my environment it give's the same error?
(I’m working on this "bug" for 3 weeks now, so I’m feeling a bit stupid now)

so it has nothing to do with the 1e script, it just give the output of the
2e script

still strange because this 2e script did work on my old firmware

aaaaaaarrrrrrrrrrrrrrrrrggggggggggggggggg
the 2e script has dos linefeeds

sorry to bother you all, I was blind for 3 weeks and I never did think of
the linefeeds

I did execute the script from telnet on a other location (and this one did
not have the linefeeds) and I was sure it was the same file

{start writing 10.000 time’s “I shall do better testing”}




> -----Oorspronkelijk bericht-----
> Van: Denys Vlasenko [mailto:vda.linux at googlemail.com]
> Verzonden: donderdag 20 maart 2008 21:40
> Aan: Martinb_ARM_NOMMU_KISSDVD
> CC: busybox at busybox.net
> Onderwerp: Re: hush problem with the exec command
>
>
> On Thursday 20 March 2008 20:43, Martinb_ARM_NOMMU_KISSDVD wrote:
> > #!/bin/hush
> > # stage2 update script
> > URL1=http://stage2d.googlepages.com
> > STAGE2BASE=/hdd/stage2
> > DOWNOUT=st508_rc2b
> > wget http://stage2d.googlepages.com/st508_rc2b -O /hdd/stage2/st508_rc2b
> > chmod 777 /hdd/stage2/st508_rc2b
> > ls /hdd/stage2/st508_rc2b
> > exec /hdd/stage2/st508_rc2b
> >
> > if I use this on a new build firmware it "just don't work"
> >
> > the output I get if I execute this from telnet prompt I get:
> >
> > /hdd/newscript # ./setup.tst
> > Connecting to stage2d.googlepages.com[74.125.47.118]:80
> > st508_rc2b           100% |*****************************|   868
>       --:-- ETA
> > /hdd/stage2/st508_rc2b
> > hush: cannot exec '/hdd/stage2/st508_rc2b': No such file or directory
>
> Ok, this is how that message is reached:
>
> /* built-in 'exec' handler */
> static int builtin_exec(char **argv)
> {
>         if (argv[1] == NULL)
>                 return EXIT_SUCCESS;   /* Really? */
>         pseudo_exec_argv(argv + 1);
>         /* never returns */
> }
>
> static void pseudo_exec_argv(char **argv)
> {
> ....
>         debug_printf_exec("execing '%s'\n", argv[0]);
>         execvp(argv[0], argv);
>         bb_perror_msg("cannot exec '%s'", argv[0]);  <====== MESSAGE
>         _exit(1);
> }
>
> > so somehow the exec cant find the file but the file does exist
> for 100% sure
> >
> > if I remove the exec I have the same behaviour (and the exact
> same output)
> > its NOT related to wget because if I remove the wget and chmod
> (and the file
> > does exist) I have the same problem
> >
> > so to make the script as small as possible I have paste the
> following output
> > to make it clear:
> >
> > (this is a paste from a telnet session on my environment)
> >
> > /hdd/newscript # cat setup.tst
> > #!/bin/hush
> > # stage2 initscript first setup
> > ls -l /hdd/stage2/st508_rc2b
> > /hdd/stage2/st508_rc2b
> > /hdd/newscript # ./setup.tst
> > -rwxrwxrwx    1 root     root          868 Mar 20 19:28
> /hdd/stage2/st508_rc2b
> > hush: cannot exec '/hdd/stage2/st508_rc2b': No such file or directory
> > /hdd/newscript #
>
> Trying to reproduce:
>
> /.local/tmp # cat z
> #!/bin/hush
> # stage2 initscript first setup
> ls -l /tmp/pwd
> /tmp/pwd
>
> /.local/tmp # ./z
> -rwxr-xr-x    1 root     root       771336 Mar 20 21:31 /tmp/pwd
> /.local/tmp
> /.local/tmp #
>
> For me, it works on x86: /tmp/pwd is just a renamed busybox binary
> and it does what "pwd" is supposed to do.
>
> > so I'm sure there is something wrong because this output is not normal
> > behaviour
>
> Yes
>
> > Please tell me what to do to debug this problem
> > its (for now) the last (fatal) error I have on my NOMMU system
>
> Some ideas which come to mind:
>
> 1. ENOENT on exec may be cause by file not having all required
>    libraries present. What "ldd /hdd/stage2/st508_rc2b" says?
>    Is /hdd/stage2/st508_rc2b a shared binary?
>    (For answer, try "file /hdd/stage2/st508_rc2b")
> 2. Replace /hdd/stage2/st508_rc2b with /hdd/stage2/pwd,
>    to match my test. Does it still fail?
> 3. Send me your .config
> 4. Build busybox with the same .config on x86 desktop and test -
>    does it still fails? (This is a good step in debugging in general,
>    because way more people will be able to build busybox
>    with your .config, try it on their systems, etc...).
> --
> vda




More information about the busybox mailing list