Skip to content

cp -p fails to preserve group, if user can't be preserved #8383

@drinkcat

Description

@drinkcat

Part of tests/cp/preserve-gid.

Simplified:

sudo rm c1*
touch c1
sudo chown root:wheel c1
cp -p c1 c1-gnucopy
cargo run cp -p c1 c1-uucopy
ls -l c1*

Output:

 rw-r--r-- 1 root     wheel    0 Jul 24 16:48 c1
-rw-r--r-- 1 drinkcat wheel    0 Jul 24 16:48 c1-gnucopy
-rw-r--r-- 1 drinkcat drinkcat 0 Jul 24 16:48 c1-uucopy

c1-uucopy should have wheel group.

2 notes:

  • It's ok for the group to be reset to default if the user is not a member of it (I picked wheel because drinkcat is part of it). root:11234 is reset to drinkcat:drinkcat.
  • This works fine with drinkcat:wheel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions