Skip to content

chmod: Fix chmod -c --reference reporting when no change is made#6016

Merged
cakebaker merged 5 commits intouutils:mainfrom
mtimaN:chmod_changes
Feb 26, 2024
Merged

chmod: Fix chmod -c --reference reporting when no change is made#6016
cakebaker merged 5 commits intouutils:mainfrom
mtimaN:chmod_changes

Conversation

@mtimaN
Copy link
Copy Markdown
Contributor

@mtimaN mtimaN commented Feb 25, 2024

Fix for issue #6009.
I changed the code so that the old permission octal is retrieved in "full form" (6 octal digits). It is afterwards set to 4 digits when displayed.

Beforehand, 2 identical permissions were marked as different because of the different formats, resulting in incorrect displays for -c.

@mtimaN mtimaN changed the title Make fperm hold 6 digit octal permission. Set it to 4 digits when displaying. chmod: make fperm hold 6 digit octal permission. Set it to 4 digits when displaying. Feb 25, 2024
@BenWiederhake
Copy link
Copy Markdown
Collaborator

Is it possible to add a test for this? :)

@mtimaN mtimaN changed the title chmod: make fperm hold 6 digit octal permission. Set it to 4 digits when displaying. chmod: Fix chmod -c --reference reporting when no change is made Feb 25, 2024
@cakebaker cakebaker linked an issue Feb 25, 2024 that may be closed by this pull request
@mtimaN
Copy link
Copy Markdown
Contributor Author

mtimaN commented Feb 25, 2024

@BenWiederhake yep! It also failed a test beforehand so I kind of flipped the logic: made the reference permission 4 octals long, just as the others.

@github-actions
Copy link
Copy Markdown

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/inotify-dir-recreate (passes in this run but fails in the 'main' branch)

@cakebaker cakebaker merged commit 095eced into uutils:main Feb 26, 2024
@cakebaker
Copy link
Copy Markdown
Contributor

Thanks for your PR!

@mtimaN mtimaN deleted the chmod_changes branch February 26, 2024 10:02
ysthakur pushed a commit to ysthakur/coreutils that referenced this pull request Feb 27, 2024
…ils#6016)

* Make fperm hold 6 digit octal permission. Set it to 4 digits when displaying

* Add test

* Make every permission 4 octal digits

* Change test name to be more suggestive

* chmod: merge two args in test

---------

Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

chmod: -c reports changes even on no-op

3 participants