Search $PATH failure?
Denys Vlasenko
vda.linux at googlemail.com
Mon Dec 5 01:55:48 UTC 2011
On Friday 02 December 2011 05:45, Bart Kus wrote:
> Ok, let's try this again, this time when a bit less sleep deprived:
>
>
> jo tmp # (mkdir ram && cd ram && gunzip < /boot/initramfs | cpio -idm)
> 37624 blocks
> jo tmp # PATH= /usr/bin/chroot ram bin/busybox ash
> / # PATH=/bin:/usr/bin
> / # export PATH
> / # echo $PATH
> /bin:/usr/bin
> / # uname
> ash: uname: not found
> / # ls -l /bin/uname /bin/busybox
> -rwxr-xr-x 1 0 0 2087264 Dec 1 09:03 /bin/busybox
> lrwxrwxrwx 1 0 0 7 Dec 2 04:14 /bin/uname ->
> busybox
> / #
>
>
> I don't think the device node failures have anything to do with $PATH
> processing, but they've been addressed in this example.
>
> It's sufficient to just set PATH=/bin without exporting since I don't
> care if the uname process environment has a PATH variable. In this
> example $PATH is only set so ash can use it to find uname and execute
> it. However I've exported it as per your request.
>
> Now, to flex the code path where $PATH is set to a sufficient value
> prior to busybox/ash execution, here's the last example:
>
>
> jo tmp # PATH=/bin:/usr/bin /usr/bin/chroot ram bin/busybox ash
> / # echo $PATH
> /bin:/usr/bin
> / # uname
> ash: uname: not found
> / #
>
>
> You agree this is incorrect behavior, yes?
>
I can't reproduce it with your .config - for me, uname runs just fine
in the setup similar to those shown above.
Can you post the strace of the attempt to execute "uname" in ash?
--
vda
More information about the busybox
mailing list