Sergey, On Wed, Feb 11, 2009 at 04:50:55PM -0800, Kees Cook wrote: > 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...
[...] > 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 (); > } _______________________________________________ Bug-cpio mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-cpio
