bugGNU cpio - Bugs: bug #24652, pass-through copy (user root)...


bug #24652: pass-through copy (user root) don't preserve directory owner when they are not empty

Submitted by:  Mike Frysinger <vapier>
Submitted on:  Sun 26 Oct 2008 12:44:17 PM UTC  
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: Open

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


Sat 09 Oct 2010 11:53:46 PM UTC, comment #2:

i retested with cpio-2.11 and it seems to work with my test case, so i guess this can be closed ...

Mike Frysinger <vapier>
Mon 18 Jan 2010 03:42:18 PM UTC, comment #1:

Seems like copypass() creates the intermediate directory when trying to create a file, and schedules a set_perms() via delay_set_stat().

However when copypass() subsequently gets data for the directory permissions/ownership from the input stream, and then calls set_perms() directly, it doesn't do anything about the existing delay entry, which causes the correct perms from the input stream to be overridden at the end by apply_delayed_set_stat().

It looks like repair_delayed_set_stat() isn't used anymore?, and probably should be renamed to remove_delayed_set_stat(), and hacked appropriately.

copyin() probably has similar issues.

I have already had to rebuild 2 machines after root file system relocation didn't quite work right because of this bug causing my normal find . -xdev -depth -print0 | cpio -pdmu to not quite replicate correctly.

As such, I'd like to get this bug fixed, and will proceed down the lines above unless someone has a better idea, however since this bug seems to have been around for 18 months, I'll be surprised if I get a response.

scott merrilees <samarium>
Sun 26 Oct 2008 12:44:17 PM UTC, original submission:

this is with cpio-2.9

test case when run as root:
rm -rf TEST OUT
mkdir -p TEST/TMP{1,2}
touch TEST/TMP1/empty
chown -R bin TEST
find TEST -depth -print|cpio -pdmv ./OUT/
ls -la TEST/ OUT/TEST/

we see that in the original TEST tree, all was owned by bin:
# ls -al TEST/
total 16
drwxr-xr-x 4 bin root 4096 2008-10-26 08:42 .
drwxr-xr-x 5 root root 4096 2008-10-26 08:42 ..
drwxr-xr-x 2 bin root 4096 2008-10-26 08:42 TMP1
drwxr-xr-x 2 bin root 4096 2008-10-26 08:42 TMP2

but in the OUT/ dir, TMP1 has wrong ownership:
# ls -al OUT/TEST/
total 16
drwxr-xr-x 4 root root 4096 2008-10-26 08:42 .
drwxr-xr-x 3 root root 4096 2008-10-26 08:42 ..
drwxr-xr-x 2 root root 4096 2008-10-26 08:42 TMP1
drwxr-xr-x 2 bin root 4096 2008-10-26 08:42 TMP2

Mike Frysinger <vapier>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -unavailable- added by samarium (Posted a comment)
  • -unavailable- added by vapier (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    No Changes Have Been Made to This Item

    Back to the top

    Powered by Savane 3.1-cleanup1