On Thu, Nov 14, 2019 at 1:36 PM Christian Weisgerber <na...@mips.inka.de>
wrote:

> I found this discrepancy surprising:
>
> $ find /bin -print | cpio -o -Hustar >foo
> $ file foo
> foo: POSIX tar archive
> $ find /bin -print | cpio -Hustar -o >foo
> $ file foo
> foo: ASCII cpio archive (SVR4 with CRC)
>
> The argument order should not matter here.
>
> Fix: When processing the -o switch, only set the archive format if
> not already set.
>
> ok?
>
> Index: bin/pax/options.c
> ===================================================================
> RCS file: /cvs/src/bin/pax/options.c,v
> retrieving revision 1.102
> diff -u -p -r1.102 options.c
> --- bin/pax/options.c   13 Sep 2018 12:33:43 -0000      1.102
> +++ bin/pax/options.c   14 Nov 2019 20:59:04 -0000
> @@ -1226,7 +1226,8 @@ cpio_options(int argc, char **argv)
>                                  * create an archive
>                                  */
>                                 act = ARCHIVE;
> -                               frmt = &(fsub[F_CPIO]);
> +                               if (frmt == NULL)
> +                                       frmt = &(fsub[F_CPIO]);
>                                 break;
>                         case 'p':
>                                 /*
>

ok guenther@

Reply via email to