cpio bug - symlinks ovewrite regular files

LEVAI Daniel leva at ecentrum.hu
Thu Jun 17 20:36:18 UTC 2010


On cs, jún 17, 2010 at 15:26:21 -0500, Rob Landley wrote:
> On Friday 11 June 2010 07:59:41 LEVAI Daniel wrote:
> > I've discovered a bug in busybox cpio:
[...]
> > The setuid/setgid bits didn't get restored.
> > It seems like the situation where one changes the mode bits prior to
> > changing the owner/group on a file:
> 
> Could be.
> 
> This code is in archival/libunarchive/data_extract_all.c and shared with tar 
> and unzip and such.  Does "tar xp" get it right?
Nope, tar makes the same mistake.


> > I couldn't find the corresponding cpio(1) code in the busybox source
> > (although I must admit I didn't try very hard), but I also noticed
> > another bug, which is kind of the same in sed(1):
> > It changes the modes before the owners when editing files in place, so
> > the setuid/setgid bits are also gets lost.
> 
> The gnu version of sed drops the permissions too.  This seems intentional, and 
> like a good idea.

On a second thought, yes, this does sound like a good idea.


Daniel

-- 
LÉVAI Dániel
PGP key ID = 0x83B63A8F
Key fingerprint = DBEC C66B A47A DFA2 792D  650C C69B BE4C 83B6 3A8F
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: not available
URL: <http://lists.busybox.net/pipermail/busybox/attachments/20100617/ba74e3a4/attachment.pgp>


More information about the busybox mailing list