[Bug 3337] Command line parsing error

bugzilla at busybox.net bugzilla at busybox.net
Mon May 9 01:17:43 UTC 2011


--- Comment #4 from Denys Vlasenko <vda.linux at googlemail.com>  ---
(In reply to comment #2)
> > 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.

This may well be one. Resetting getopt is a somewhat non-well standardized

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