Skip to content

du: only warn when -s is given with --max-depth=0 - #16687

Open
Xnadir wants to merge 2 commits into
uutils:mainfrom
Xnadir:du-summarize-depth-zero
Open

Xnadir wants to merge 2 commits into
uutils:mainfrom
Xnadir:du-summarize-depth-zero

Conversation

@Xnadir

@Xnadir Xnadir commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

du -s --max-depth=0 FILE failed with summarizing conflicts with --max-depth=0. GNU accepts it, prints du: warning: summarizing is the same as using --max-depth=0 and goes on (this is the du note at the end of #16646). Any other depth still conflicts with -s.

The depth is now validated before the -s check, so du -s --max-depth=abc reports invalid maximum depth 'abc' like GNU, instead of the conflict.

The new test covers -s --max-depth=0, -d 0 -s, -s --max-depth=1 and -s --max-depth=abc; it fails on main. I added the warning to the en-US and fr-FR locales.

Refs #16646

AI disclosure: written with help from Claude Code.

Copilot AI balanced review requested due to automatic review settings November 18, 2026 15:11

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. Try requesting a review at a lower effort level.

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 tests/by-util/test_du.rs
ts.ucmd()
.args(&["-s", "--max-depth=1", "deep"])
.fails_with_code(1)
.no_stdout()

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.

could check the full message, --max-depth=1?

@codspeed

codspeed Bot commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 4.59%

2 warnings

⚠️ 4 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

⚠️ 1 benchmark with a significant change ran on different hardware

Its base and head results were measured on machines with a different CPU, core count or memory, so the change might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

⚡ 1 improved benchmark
✅ 7 untouched benchmarks
⏩ 476 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation du_deep_tree[(100, 3)] 1.8 ms 1.7 ms +4.59%

Tip

Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.


Comparing Xnadir:du-summarize-depth-zero (3eaf912) with main (c44859c)2

Open in CodSpeed

Footnotes

  1. 476 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 (066f9d0) during the generation of this report, so c44859c was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩

@github-actions

Copy link
Copy Markdown

Binary size comparison:

Individual binary size comparison VS main (threshold: >=5% AND >=4 KB).

Total size of compared binaries: 155.49 MB (+104 KB, +0.07%)

Significant per-binary changes:
  env     1.20 MB ->    1.28 MB  (+80 KB, +6.51%)

Copilot AI balanced review requested due to automatic review settings November 19, 2026 22:53

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. Try requesting a review at a lower effort level.

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.

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.

3 participants