Skip to content

du: let -P after --dereference-args win - #16014

Merged
sylvestre merged 5 commits into
uutils:mainfrom
Logic769:du-last-of-dereference-args-wins
Nov 10, 2026
Merged

sylvestre merged 5 commits into
uutils:mainfrom
Logic769:du-last-of-dereference-args-wins

Conversation

@Logic769

@Logic769 Logic769 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

GNU du lets the last of -P/--no-dereference and --dereference-args win, so du --dereference-args -P dangling does not dereference the dangling symlink argument and succeeds. uutils always let --dereference-args win and failed with "cannot access".

This makes the dereference flags (-L, --dereference-args, -P) mutually override so the last one on the command line wins, matching GNU.

Adds a regression test.

Closes #16003

@Logic769
Logic769 force-pushed the du-last-of-dereference-args-wins branch from e07e579 to 1e0ea04 Compare October 30, 2026 13:03
Comment thread src/uu/du/src/du.rs Resolved
Comment thread tests/by-util/test_du.rs Resolved
Comment thread tests/by-util/test_du.rs Resolved
@Logic769
Logic769 force-pushed the du-last-of-dereference-args-wins branch from 1e0ea04 to 58dc7fa Compare November 2, 2026 02:48
Comment thread tests/by-util/test_du.rs Resolved
@sylvestre

Copy link
Copy Markdown
Contributor

a bunch of jobs are failing

@Logic769
Logic769 force-pushed the du-last-of-dereference-args-wins branch from f905743 to 8048890 Compare November 3, 2026 15:43
@Logic769

Logic769 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Failure

The Build (macos-latest, x86_64-apple-darwin, feat_os_unix, true, PGO) job (126116061882) failed in test_tail::test_follow_symlink_appends:

thread 'test_tail::test_follow_symlink_appends' panicked at tests/by-util/test_tail.rs:5564:14:
assertion failed: `(left == right)`
Diff < left / right > :
 a
 b
>c

test result: FAILED. 5976 passed; 1 failed; 69 ignored

Reason

This is the known intermittent failure tracked in #15568: the report has the same command (tail -s.1 --max-unchanged-stats=1 -f latest.log) and the same missing appended line. This PR only touches src/uu/du/src/du.rs and tests/by-util/test_du.rs, not tail or tests/by-util/test_tail.rs. Please rerun the job.

@Logic769

Logic769 commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

Failure

The L10n/Build and Test (macos-latest, feat_os_unix) job (126024562428) failed in test_shred::test_shred_dash_wipes_stdout_file:

thread 'test_shred::test_shred_dash_wipes_stdout_file' panicked at tests/by-util/test_shred.rs:643:10:
stderr = shred: failed to get file metadata: Bad file descriptor
test result: FAILED. 5058 passed; 1 failed; 25 ignored

Reason

This PR only changes src/uu/du/src/du.rs and tests/by-util/test_du.rs; the failure is in an unrelated macOS-specific shred stdout test. It is not caused by the du change. Please rerun the job.

@sylvestre
sylvestre merged commit 6789bc3 into uutils:main Nov 10, 2026
153 of 155 checks passed
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.

du: -P after --dereference-args should win

2 participants