Skip to content

find: print special bits and no padding in -printf %m - #891

Open
youdie006 wants to merge 1 commit into
uutils:mainfrom
youdie006:printf-mode-special-bits
Open

youdie006 wants to merge 1 commit into
uutils:mainfrom
youdie006:printf-mode-special-bits

Conversation

@youdie006

Copy link
Copy Markdown

Part of #890.

-printf %m masked the mode with 0o777 and padded it to three digits, so a setuid binary printed 755, /tmp printed 777 and a 044 file printed 044. GNU find prints mode & 07777 in plain octal: 4755, 1777, 44. This uses {:o} of mode & 0o7777 and 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 warnings and cargo test pass.

Written with AI assistance (Claude); I have reviewed the change.

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.
Copilot AI balanced review requested due to automatic review settings October 2, 2026 02:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

2 participants