Skip to content

cp, mv: name the failing step in permission errors - #15932

Draft
LoukasPap wants to merge 1 commit into
uutils:mainfrom
LoukasPap:cp-mv-specific-errors
Draft

LoukasPap wants to merge 1 commit into
uutils:mainfrom
LoukasPap:cp-mv-specific-errors

Conversation

@LoukasPap

Copy link
Copy Markdown
Contributor

Fixes #15920

cp and mv hid which step failed behind generic permission errors.

cp

  • cp file1 dir2/file1 with an unreadable file1 printed 'file1' -> 'dir2/file1': Permission denied. It now prints cannot open 'file1' for reading: Permission denied.

mv

  • mv file1 dir2/file1 with dir2 writable but not searchable printed Permission denied (os error 13)
  • mv file1 dir2/ printed cannot move 'file1' to 'dir2/file1'.

Both now print cannot stat 'dir2/file1': Permission denied.

I changed the expected message in test_cp_reflink_insufficient_permission, which asserted the old wording, and added a test for each case.

Copilot AI balanced review requested due to automatic review settings October 27, 2026 22: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 insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@codspeed

codspeed Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will degrade performance by 4.24%

2 warnings

⚠️ 9 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚠️ Base and head ran on different runner types

Some benchmarks with significant performance changes were compared across different runner types, so the changes might not come from the code. Run base and head on the same runner type, or use CodSpeed Macro Runners for more stable results.

Learn more about Macro Runners

Open the report in CodSpeed to investigate

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 17 untouched benchmarks
⏩ 452 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ Memory cp_recursive_deep_tree[(120, 4)] 532.6 KB 699.2 KB -23.82%
⚡ CPU Simulation mv_force_overwrite 154.4 ms 128.3 ms +20.37%

Tip

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


Comparing LoukasPap:cp-mv-specific-errors (99b458c) with main (1542121)2

Open in CodSpeed

Footnotes

  1. 452 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. ↩

  2. No successful run was found on main (32b2d60) during the generation of this report, so 1542121 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

Copilot AI balanced review requested due to automatic review settings October 27, 2026 22:58

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 insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

Comment thread src/uu/mv/locales/en-US.ftl Outdated
@@ -18,6 +18,7 @@ mv-after-help = When specifying more than one of -i, -f, -n, only the final one
# Error messages
mv-error-insufficient-arguments = The argument '<{$arg_files}>...' requires at least 2 values, but only 1 was provided
mv-error-no-such-file = cannot stat {$path}: No such file or directory

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.

Can we drop this transtation using ENOTDIR and new translation?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

So drop this with mv-error-cannot-stat-not-directory and instead use mv-error-cannot-stat while supplying the trailing OS error?

Copilot AI balanced review requested due to automatic review settings October 28, 2026 14: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 insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.

@LoukasPap
LoukasPap marked this pull request as draft October 28, 2026 14:36
cp reported an unreadable source as "'src' -> 'dst': Permission denied"
and mv reported a target in a directory without search permission as a
bare "Permission denied (os error 13)" or "cannot move". Report
"cannot open 'src' for reading" and "cannot stat 'dst'" instead, as GNU
does.

mv now builds every "cannot stat" message from one string plus the OS
error, replacing the separate no-such-file and not-a-directory ones.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@LoukasPap
LoukasPap force-pushed the cp-mv-specific-errors branch from 265da89 to 99b458c Compare October 28, 2026 15:54

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.

Unhelpful error messages from mv and cp

3 participants