Skip to content

chown, chgrp: change a directory operand that cannot be read - #15124

Open
abendrothj wants to merge 2 commits into
uutils:mainfrom
abendrothj:chown-unreadable-dir-operand
Open

abendrothj wants to merge 2 commits into
uutils:mainfrom
abendrothj:chown-unreadable-dir-operand

Conversation

@abendrothj

Copy link
Copy Markdown
Contributor

A directory operand was changed through a descriptor opened for reading, and when that open failed the change was skipped without a message.

Without -R the directory is now changed like any other file: by name, or through an O_PATH descriptor with --from. Under -R it's still left alone with exit 1, as with GNU 9.12. Test: test_chown_unreadable_dir_operand.

Based on #15029; only the last commit is new.

Closes #15114

Copilot AI balanced review requested due to automatic review settings October 6, 2026 07:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@codspeed

codspeed Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 5.98%

⚠️ 121 benchmarks spent significant time in system calls

System calls cannot be consistently instrumented, so they are not included in the measure, which understates the real cost. Please switch to the Walltime instrument to accurately measure system calls.

Measurement and system calls

ℹ️ 1 benchmark has no flame graph

The flamegraph could not be generated because too much time was spent in runtime internals, making the visualization not useful for performance analysis.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 2 regressed benchmarks
✅ 398 untouched benchmarks
⏩ 54 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Simulation five_38_bit_primes 1.6 s 1.8 s -12.27%
❌ Simulation three_39_bit_primes 583.2 ms 644.8 ms -9.55%
⚡ Simulation thirteen_39_bit_primes 9.1 s 8.7 s +4.74%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing abendrothj:chown-unreadable-dir-operand (c17a06e) with main (6292c03)

Open in CodSpeed

Footnotes

  1. 54 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@abendrothj
abendrothj force-pushed the chown-unreadable-dir-operand branch from 214b811 to f1ff0e1 Compare October 7, 2026 02:27
Copilot AI balanced review requested due to automatic review settings October 7, 2026 02:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

@abendrothj
abendrothj force-pushed the chown-unreadable-dir-operand branch from f1ff0e1 to d2406f8 Compare October 7, 2026 08:02
Copilot AI balanced review requested due to automatic review settings October 7, 2026 08:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

--from was checked on a stat of the name and the change was then made
by name, so a rename landing in between changed a file that never had
the required owner.

On Linux, hold the file open with O_PATH, check that it is the one that
was stat'd and still passes --from, and change it through that
descriptor with fchownat(AT_EMPTY_PATH). This covers operands and -R
entries. A file found replaced is left alone; as with GNU, that fails
without a message, and -v reports the change that was not made.
On Linux, a directory operand was changed through a descriptor opened
for reading, and when that open failed it was skipped without a
message. Change it by name then, or through an O_PATH descriptor with
--from, as for any other file. Under -R it is still left alone and the
failure to read it reported, as with GNU.
@abendrothj
abendrothj force-pushed the chown-unreadable-dir-operand branch from d2406f8 to c17a06e Compare October 12, 2026 11:38
Copilot AI balanced review requested due to automatic review settings October 12, 2026 11:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

This branch has not been deployed

No deployments
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.

chown, chgrp: a directory operand that can't be read is skipped silently

2 participants