Repository navigation
Conversation
sylvestre
reviewed
Oct 30, 2026
| // Without -o, -C must still give the file to the invoker. | ||
| run_and_check(&["-Cv", "-g2", "a", "b"], "b", 0, 2); | ||
|
|
||
| run_and_check(&["-Cv", "-o2", "c", "d"], "d", 2, 0); |
Contributor
There was a problem hiding this comment.
could you please also cover the -o only case from the issue? e.g. rerun -Cv -o2 c d and check stdout is empty (no recopy)
Contributor
Author
There was a problem hiding this comment.
Done, the test now reruns -Cv -o2 c d and checks nothing is printed. Since it needs root, I also checked it by hand in a user namespace: main copies the file again, this branch doesn't, same as GNU. Updated in 89f4b9e.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #15766
With
-C,need_copy()only compared the destination's owner when-owas given. With-galone, an identical file owned by another user was kept as is (exit 0), instead of being replaced by one owned by the invoker. The reverse was off too:-C -o USERwithout-gcompared against the effective uid instead of USER, so the file got recopied on every run.This applies @sylvestre's suggested fix from the issue.
need_copy()now always checks the owner, against the-ouid or the effective uid, and the helper is renamedneeds_copy_for_group()since it only handles the group now. I added the issue's assertion totest_install_root_combined. That test needs root, so I also checked the case by hand in a user namespace, where the result now matches GNU install.