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

Submitter:  Mike Frysinger <vapier>
Submitted:  Sun 26 Oct 2008 12:44:17 PM UTC
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup

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 Files:

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.


    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-04-28 gray StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.12