Package: cpio Version: 2.9-14 Severity: normal Tags: patch User: ubuntu-de...@lists.ubuntu.com Usertags: origin-ubuntu jaunty ubuntu-patch
It seems that cpio does not actually use the error codes it sets while running, and always exits with 0. This will break anything that expects cpio to fail if it encounter problems (like, say, mkinitramfs). All the error handling code is in paxlib, which includes the "pax_exit()" function. src/main.c's main should call pax_exit, not "exit (0)" like it currently does. Example: $ cd /tmp/busticated $ ls -lR .: total 4 drwxr-xr-x 2 kees kees 4096 Feb 12 00:27 sbin ./sbin: total 0 lrwxrwxrwx 1 kees kees 20 Feb 12 00:27 no-such-binary -> /sbin/no-such-binary What current happens with failures: $ find . | cpio -L -o > /tmp/archive.cpio cpio: ./sbin/no-such-binary: No such file or directory 1 block $ echo $? 0 I would expect this instead: $ find . | cpio -L -o > /tmp/archive.cpio cpio: ./sbin/no-such-binary: No such file or directory 1 block $ echo $? 2 Attached trivial patch changes the behavior... -Kees -- Kees Cook @debian.org
diff -u cpio-2.9/src/main.c cpio-2.9/src/main.c --- cpio-2.9/src/main.c +++ cpio-2.9/src/main.c @@ -801,3 +801,3 @@ - exit (0); + pax_exit (); }