[Bug 3337] Command line parsing error

bugzilla at busybox.net bugzilla at busybox.net
Tue Mar 1 06:20:52 UTC 2011


https://bugs.busybox.net/show_bug.cgi?id=3337

--- Comment #2 from Alex Firago <melgort at gmail.com>  ---
> Under which shell do you do it? ash from the same busybox binary?
  I use ash from busybox.

> Can you reproduce it on a ix86 Linux distribution machine?
  I've tryed reproduce this bug on x86 with GNU libc, but there was no this
bug.

I've found some intresting thing in libbb/getopt32.c. In function uint32_t
FAST_FUNC getopt32(char **argv, const char *applet_opts, ...).

http://git.busybox.net/busybox/tree/libbb/getopt32.c?h=1_15_stable#n532 <- here
optind resets to 0. After that,
http://git.busybox.net/busybox/tree/libbb/getopt32.c?h=1_15_stable#n550 <- here
getopt() from uClibc called, but on ARM system optind is still 0, however on
x86 optind is 1 in this place. 

So busybox commands (for example cat -
http://git.busybox.net/busybox/tree/coreutils/cat.c?h=1_15_stable#n46) add
optind which is 0 to argv and then parse options from argv[0] which is command
name.

So, i guess, it's not busybox bug, but uClibc bug.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.


More information about the busybox-cvs mailing list