bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cpio] Re: Bug#514936: cpio does not use error codes on exit


From: Clint Adams
Subject: [Bug-cpio] Re: Bug#514936: cpio does not use error codes on exit
Date: Thu, 12 Feb 2009 18:33:15 +0000
User-agent: Mutt/1.5.18 (2008-05-17)

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 ();
>  }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]