unzip applet not working ?

walter harms wharms at bfs.de
Fri Jun 15 07:48:09 UTC 2012



Am 14.06.2012 23:36, schrieb John Spencer:
> On 06/14/2012 09:50 PM, Dan Fandrich wrote:
>> On Wed, Jun 13, 2012 at 07:37:13PM +0200, John Spencer wrote:
>>> I could trace it back to
>>>
>>> /* '-' makes getopt return 1 for non-options */
>>> while ((opt = getopt(argc, argv, "-d:lnopqxv")) != -1)
>>>
>>> this returns *not* 1 with musl. according to Rich the commented
>>> behaviour is a gnuism and not POSIX.
>> I've run into the same issue. Attached is the patch I use to work around
>> it.
>>
> the unzip applet may be a candidate for custom argv parsing code, getopt
> doesn't seem to be a good fit in this case,
> especially considering Doug Clapp's report (apparently not even on glibc
> all options behave as they should).
> 
> but then, i've never gotten around to study the getopt manpage, so there
> may be some trick to make it work in a POSIX conformant fashion.
> 
hi,

I do not know the POSIX requirements in detail but the man page says:
       If  the first character of optstring is '+' or the envi-
       ronment variable POSIXLY_CORRECT is set, then option  processing  stops
       as soon as a nonoption argument is encountered.
and later:
       POSIX.2 and  POSIX.1-2001,  provided  the  environment  variable
       POSIXLY_CORRECT  is set.

Perhaps you can post a combination where bb_unzip breaks with glibc ?
What ever specs are used, we should have at least a *one* unzip where everything
works like advertised.

re,
 wh


More information about the busybox mailing list