Conversation
Mask the mode with 0o7777 instead of 0o777 and drop the three-digit padding, as GNU find does: 4755 is printed as 4755, 044 as 44.
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.
Part of #890.
-printf %mmasked the mode with0o777and padded it to three digits, so a setuid binary printed755,/tmpprinted777and a 044 file printed044. GNU find printsmode & 07777in plain octal:4755,1777,44. This uses{:o}ofmode & 0o7777and adds a unit test for 4755 and 044.On a tree with setuid, setgid, sticky, 000, 044 and 7777 modes,
-printf '%m %p\n'output is now identical to GNU find 4.9.0.cargo fmt --check,cargo clippy --all-targets -- -D warningsandcargo testpass.Written with AI assistance (Claude); I have reviewed the change.