When building busybox 1.18.4 with crosstool-ng 1.10.1 and uClibc 0.9.30.2 building GCC 4.2.4, busybox compiled to use hush improperly passes parameters to applets. Example: if you type 'busybox ls', it passes 'ls' as a argument to the applet 'ls' effectivly making it 'busybox ls ls'. Similarly 'busybox mount' passes 'mount' to mount. Linking busybox to 'ls' and calling 'ls' still exhibits the problem. This problem makes many applets malfunction. It is probably putting what should be in argv[0] into argv[1].
4.2.x is too buggy. Also, please use the current stable release (with 4.5.x)
Waiting for rebuild (again) It built a broken 4.5 compiler so I am trying 4.4
Couldn't build a 4.5.x compiler but I built a 4.4.x compiler and the bug still exists. "/busybox ls" == "/busybox ls ls"
So what do you see for: cd /tmp rm -f ls ln -s /busybox ls ./ls -l
(In reply to comment #4) > So what do you see for: > cd /tmp > rm -f ls > ln -s /busybox ls > ./ls -l / # cd /tmp / # rm -f ls Cannot remove ls: No such file or directory / # ln -s /busybox ls / # ./ls -l ls: -l: No such file or directory /bin/ls / #
(In reply to comment #4) > So what do you see for: > cd /tmp > rm -f ls > ln -s /busybox ls > ./ls -l / # cd /tmp / # rm -f ls Cannot remove ls: No such file or directory / # ln -s /busybox ls / # ./ls -l ls: -l: No such file or directory ./ls / # ^^ Updated - I made a mistake copying from qemu
Would a video of the offending bug help?
No, but ldd and strace output (assuming you do them with 0.9.31 or master).
(In reply to comment #8) > No, but ldd and strace output (assuming you do them with 0.9.31 or master). Sorry, do not know how to use strace $ ldd busybox Checking sub-depends for '/usr/lib/libcrypt.so.0' Checking sub-depends for '/usr/lib/uClibc.so.0' libcrypt.so.0 => /usr/lib/libcrypt.so.0 (0x00000000) uClibc.so.0 => /usr/lib/uClibc.so.0 (0x00000000) /lib/ld-uClibc.so.0 => /lib/ld-uClibc.so.0 (0x00000000) $ ^^ Isn't all zeros for the address alittle odd?
Any suggestions?
Here is a workaround patch Apply to ./libbb/appletlib.c: *** appletlib.c 2011-05-13 21:40:36.000000000 -0700 --- appletlib/c 2011-05-13 21:35:03.000000000 -0700 *************** void FAST_FUNC run_applet_no_and_exit(in *** 763,769 **** } if (ENABLE_FEATURE_SUID) check_suid(applet_no); ! exit(applet_main[applet_no](argc, argv)); } void FAST_FUNC run_applet_and_exit(const char *name, char **argv) --- 763,769 ---- } if (ENABLE_FEATURE_SUID) check_suid(applet_no); ! exit(applet_main[applet_no](argc, argv+1)); } void FAST_FUNC run_applet_and_exit(const char *name, char **argv)
Issue though. It causes it to Segmentation fault even more. (Randomly...Was doing it before, just not as much)
I managed to find the core of the problem. uClibc poses itself as glibc and defines __GLIBC__. This causes the #ifdef __GLIBC__ to evaluate to true and resets optind to zero instead of one. Unfortunately the uClibc getopt() is BSD style and pukes and keeps optind at zero. Putting an exception for uClibc in libbb/getopt32.c libbb/vfork_daemon_rexec.c shell/shell_common.c util-linux/getopt.c fixed the problem.