> > BusyBox 1.16.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
> 
> 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 */

These two are OK.

>          || (!(opt & OPT_list_installed) && !argv[0]) /* - all except
> -l require argument */

This is duplicate check to:

        if (!deb_count)
                bb_error_msg_and_die("no package files specified");

I prefer simple "no package files specified" error for "dpkg -i". Your
version changes it to bb_show_usage().


Real dpkg says:

dpkg: --install needs at least one package archive file argument

Type dpkg --help for help about installing and deinstalling packages
...short 6 line help...
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to