[Toybox] [PATCH] cpio: fixes for Android kernel build.
enh
enh at google.com
Fri Aug 21 10:14:38 PDT 2020
On Fri, Aug 21, 2020 at 3:06 AM Rob Landley <rob at landley.net> wrote:
>
>
> On 8/19/20 6:05 PM, enh wrote:
> >
> > On Wed, Aug 19, 2020 at 3:59 PM Rob Landley <rob at landley.net
> > <mailto:rob at landley.net>> wrote:
> >
> >
> >
> > On 8/19/20 4:51 PM, enh via Toybox wrote:
> > > Allow -pd to work by changing -p from an option that takes an
> > > argument to an option that implies there will be an argument (that
> > > is, `-pd x` is `-p -d x` with x being the directory for -p, rather
> > > than `-p d x` with d being the directory, as we previously
> interpreted
> > > it).
> > >
> > > Fix -d (aka --make-directories) to not be a no-op. Previously we
> > > acted as if this was always on.
> > >
> > > Accept --quiet and effectively just ignore it, since toybox cpio
> > > doesn't seem to produce any output that --quiet would suppress.
> >
> > $ echo yank | cpio out -pd
> > cpio: You must specify one of -oipt options.
> > Try `cpio --help' or `cpio --usage' for more information.
> > It's not position independent, it uses Unix System 6 parsing logic
> like
> > "tar cvfC file dir" does. Your fix doesn't make the semantics match,
> it works
> > around a specific bug.
>
> No it doesn't. The gnu/dammit cpio is apparently using some horrible
> hand-rolled
> option parsing that's inconsistent between options:
>
aristocrats! :-)
> $ find . | cpio -Ho newc
> cpio: invalid archive format `o'; valid formats are:
> crc newc odc bin ustar tar (all-caps also recognized)
> $ find . | cpio -oH newc
> 0707010490302E0000...
>
> $ cpio -pHd newc sub
> cpio: invalid archive format `d'; valid formats are:
> crc newc odc bin ustar tar (all-caps also recognized)
> $ cpio -pdH newc sub
> cpio: Archive format is not specified in copy-pass mode (use --format
> option)
> $ cpio -pdHnewc sub
> cpio: Archive format is not specified in copy-pass mode (use --format
> option)
> $ cpio -pdHnexc sub
> cpio: invalid archive format `nexc'; valid formats are:
> crc newc odc bin ustar tar (all-caps also recognized)
>
> so -H is parsed with modern collating style, and -p is parsed with unixv6
> collating style, IN THE SAME COMMAND LINE.
>
> I'm starting to lean back towards applying your patch verbatim. While I
> _can_
> teach lib/args.c how to do that, it's TOO STUPID FOR WORDS and I'd wait
> for a
> second outright broken command to need it before... ow?
>
yeah, i'm assuming unless proven otherwise (a) nobody is actually trying to
use it with arguments in the "wrong" order and (b) cpio is the only tool
this silly. (well, maybe pax too, but you've been pretty clear about your
opinion of pax, and i've never seen anyone use it in the wild and don't
expect to.)
i think even for those of us who had to endure the days of commercial
unixes, tar is just a weird special case. this possibility certainly never
occurred to me when writing my test cases. i don't think you'd even realize
it was a possibility from the POSIX or GNU man pages either...
> Rob
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20200821/5a281986/attachment.htm>
More information about the Toybox
mailing list