[Toybox] cpio cleanup

Rob Landley rob at landley.net
Sat Mar 15 14:13:14 PDT 2014


On 03/14/14 17:16, Isaac Dunham wrote:
> I see that a bit of cleanup has happened to cpio, most of it constituting a
> significant improvement.

I have a 5am alarm programmed into my phone. Most of the time I just
turn it off and go back to sleep, but sometimes I do get up and get a
couple hours of open source development in before work. :)

> That said, it seems you gave too much credence to GNU cpio's
> documentation in one point:
> Per the POSIX standard (SUSv2) that the LSB refers to, -t is a modifier for
> the -i action and "cpio -t" is incorrect.
> (See: pubs.opengroup.org/onlinepubs/7908799/xcu/cpio.html)
> 
> BSD cpio versions make "cpio -t" an error. (Debian packages the BSD cpio
> version from libarchive as bsdcpio.)
> GNU treats it the same as "cpio -it", and documents it the way you document it.

Gotcha, so -t overrides -i but they have to be allowed together.

(I also noticed right after I checked in cleanup part 3 that main() is
closing and reopening stdin/stdout to handle -F. Have to think about
that, but the outfd bit was because I hadn't noticed it was implemented
yet and just saw the hardwired stdin/stdout file numbers. Working on
next round of cleanup now...)

> This means that it would be impossible for a script to get a listing
> from libarchive cpio and toybox cpio without having special cases.
> 
> I'm guessing this means that [!iot] should be [!io][!to].

Actually [!to] is inherent in [!dot] and [!uot]. Yes it's redundant,
there should probably be a better way to say "-d or -u is only allowed
with -i", but I haven't got a syntax for it and am loathe to complicate
the option parsing logic further even if I could think of a clean way of
specifying it in the option string.

And yes, [|iot] should probably be a group instead of | annotation after
each option, but it was implemented first and is sort of grandfathered
in. (Plus having more than one "required" group would need
dependencies... Which could probably be specified by nesting the square
brackets but I'm not going there right now.)

What would be really helpful would be test cases for all this. What
command lines am I not handling properly?

Thanks,

Rob

 1394917994.0


More information about the Toybox mailing list