[Toybox] [PATCH] cpio: support reading concatenated cpio files.

enh enh at google.com
Tue Apr 13 16:47:14 PDT 2021


Apparently this is a thing people like to do, and they use shell while
loops to do it (because cpio only reads one input file at a time from
stdin).

To make this work, we need to (a) exit with a failure status rather than
success if we hit EOF (we should never normally hit EOF because we
should read a TRAILER!!! first), and (b) skip to the end of the
TRAILER!!! record rather than just exiting immediately (so that the
_next_ cpio to run can start reading stdin at the start of a record,
rather than partway through the TRAILER!!! record that caused this cpio
to stop).

(The error message change in x8u is for the usual "it's harder to debug
if two different failure cases in the code output the exact same error
message", in this case "bad header".)
---
 tests/cpio.test   | 13 +++++++++++++
 toys/posix/cpio.c |  5 +++--
 2 files changed, 16 insertions(+), 2 deletions(-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210413/10aeb13b/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-cpio-support-reading-concatenated-cpio-files.patch
Type: text/x-patch
Size: 3156 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20210413/10aeb13b/attachment-0002.bin>


More information about the Toybox mailing list