[BusyBox] [patch] ash tryexec() problem with shell scripts
Vladimir N. Oleynik
dzo at simtreas.ru
Fri Aug 29 12:41:05 UTC 2003
Jean,
> ash is unable to execute a shell script without #! /bin/sh as the first
> line. It correctly locates the script, tries to execute it via eceve
> which fails. After that it tries to hand it over to /bin/sh which fails
> too, since
>
> - ash isn providing the absolute pathname to /bin/sh
This require for correction see process name.
> - ash isn't trying to lookup the script via PATH
Why? see shellexec()
> The following patch hands the absolute pathname to /bin/sh to solve
> this problem. It replaces argv[1] with the cmd to be executed.
I can`t reproduce your problem.
Unix calling interpeteter from exec(cmd, arg) as cmd, but process name have
arg[0] name.
If you have problem call scripts from PATH, check execute permission ;-)
> --- shell/ash.c 23 Aug 2003 10:16:09 -0000
> +++ shell/ash.c 29 Aug 2003 11:57:54 -0000
> @@ -3754,7 +3754,10 @@
> for (ap = argv; *ap; ap++)
> ;
> ap = new = ckmalloc((ap - argv + 2) * sizeof(char *));
Heh. Your patch is bad.
But require change to + 3
> - *ap++ = cmd = "/bin/sh";
> + ap[1] = cmd;
> + *ap = cmd = "/bin/sh";
This up two line must rearrange.
--w
vodz
More information about the busybox
mailing list