On Tue, Mar 30, 2010 at 1:19 PM, Kim B. Heino <[email protected]> wrote:
>> > This patch changes how dpkg handles config files. There are three
>> > modes:
>>
>> Applied with some editing.
>>
>> Please test (I mean it!) current git.
>
> It seems to work, expect this one small thing:
>
> BusyBox 1.6.0 was:
>
>  [r...@ysi5 obex]$ dpkg -i
>  dpkg: no package files specified
>
>  [r...@ysi5 obex]$ dpkg -F depends foo
>  Segmentation fault
>
> Current git is:
>
>  [r...@ysi5 obex]$ ./dpkg -i
>  Usage: dpkg [-ilCPru] [-F OPT] PACKAGE
>
>  [r...@ysi5 obex]$ ./dpkg -F depends foo
>  Segmentation fault
>
> With attached patch:
>
>  [r...@ysi5 obex]$ ./dpkg -i
>  dpkg: no package files specified
>
>  [r...@ysi5 obex]$ ./dpkg -F depends foo
>  Usage: dpkg [-ilCPru] [-F OPT] PACKAGE
>
>
> Signed-off-by: Kim B. Heino <[email protected]>

How about this more comprehensive check?

        OPT_configure            = (1 << 0),
        OPT_install              = (1 << 1),
        OPT_list_installed       = (1 << 2),
        OPT_purge                = (1 << 3),
        OPT_remove               = (1 << 4),
        OPT_unpack               = (1 << 5),
        OPTMASK_cmd              = (1 << 6) - 1,
...
        if (!(opt & OPTMASK_cmd) /* no cmd */
         || ((opt & OPTMASK_cmd) & ((opt & OPTMASK_cmd)-1)) /* more
than one cmd */
         || (!(opt & OPT_list_installed) && !argv[0]) /* - all except
-l require argument */
        ) {
                bb_show_usage();
        }

-- 
vda
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to