Repository navigation
Conversation
|
Binary size comparison: |
sylvestre
reviewed
Oct 24, 2026
| // "--reference" and MODE are mutually exclusive | ||
| // if "--reference" was used MODE needs to be interpreted as another FILE | ||
| // if "--reference" was used MODE needs to be interpreted as another FILE, | ||
| // the first one, so it must go in front to keep the command-line order |
Contributor
There was a problem hiding this comment.
could be simplified to "it is the first FILE, keep the command-line order"
sylvestre
reviewed
Oct 24, 2026
| at.set_mode("dir", 0o755); | ||
|
|
||
| ucmd.args(&["--reference=ref", "dir/file", "dir"]) | ||
| .succeeds(); |
Contributor
There was a problem hiding this comment.
please run cargo fmt, this should fit on one line
Contributor
Author
There was a problem hiding this comment.
Thanks! I simplified the comment in chmod.rs (5126783). For test_chmod.rs I tried joining the two lines, but rustfmt (chain_width = 60) splits that chain back onto two lines, so the single-line form would fail cargo fmt --check in CI. I left it as is; happy to restructure the chain if you prefer.
With --reference, clap parses the first FILE operand as MODE and uumain() appended it after the other operands, so it was processed last. Insert it at the front instead. Closes uutils#15666
sylvestre
force-pushed
the
fix/15666-chmod-reference-order
branch
from
October 26, 2026 19:56
5126783 to
f8aba5d
Compare
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.
Fixes #15666
With
--reference, clap takes the first FILE operand as MODE, anduumain()pushed it onto the end of the file list, so it was processed last. It's now inserted at the front, so operands are handled in command-line order like GNU.This changes the
-v/-coutput order, and it also fixeschmod --reference=ref dir/file dir, which used to fail with "Permission denied" becausedirlost its search bit beforedir/filewas reached.I added two tests to
tests/by-util/test_chmod.rs: one checks the-vorder fora b c, the other covers thedir/file dircase (skipped when running as root). Both fail without the fix, andtest_chmodpasses with it.cargo fmtandclippy -D warningsare clean foruu_chmod. Tested on macOS only.