Skip to content

unexpand: allow --first-only to be given twice - #16015

Merged
cakebaker merged 3 commits into
uutils:mainfrom
Logic769:unexpand-allow-repeated-first-only
Nov 6, 2026
Merged

cakebaker merged 3 commits into
uutils:mainfrom
Logic769:unexpand-allow-repeated-first-only

Conversation

@Logic769

@Logic769 Logic769 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

GNU unexpand accepts repeating --first-only, so echo a | unexpand --first-only --first-only prints a. uutils rejected the repeated flag with "cannot be used multiple times".

This lets the flag override itself so repeats are accepted, matching GNU.

Adds a regression test.

Closes #15992

@Logic769
Logic769 force-pushed the unexpand-allow-repeated-first-only branch from 1cfa280 to e566f73 Compare October 30, 2026 13:03
Comment thread src/uu/unexpand/src/unexpand.rs Resolved
Comment thread tests/by-util/test_unexpand.rs Resolved
@Logic769

Copy link
Copy Markdown
Contributor Author

Dropped the manual handling and used .args_override_self(true), the same as expand. Tests cover -a -a and -f --first-only.

@cakebaker
cakebaker force-pushed the unexpand-allow-repeated-first-only branch from ef79439 to be27bcc Compare November 1, 2026 15:49
@Logic769
Logic769 force-pushed the unexpand-allow-repeated-first-only branch from be27bcc to 04e8ded Compare November 2, 2026 01:02
Comment thread tests/by-util/test_unexpand.rs Resolved
@codspeed

codspeed Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

1 warning

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

✅ 4 untouched benchmarks
⏩ 468 skipped benchmarks1


Comparing Logic769:unexpand-allow-repeated-first-only (76a7ccd) with main (c5ce288)2

Open in CodSpeed

Footnotes

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

@sylvestre

Copy link
Copy Markdown
Contributor

a bunch of jobs are failing

@Logic769
Logic769 force-pushed the unexpand-allow-repeated-first-only branch from f1f123a to 76a7ccd Compare November 3, 2026 15:43
@Logic769

Logic769 commented Nov 3, 2026

Copy link
Copy Markdown
Contributor Author

Failure

Tests job 126024487176:

error: failed to determine package fingerprint for build script for uucore v0.13.0 (.../src/uucore)
...
  Failed to read the directory at '.../src/uucore/uucore_fs_test_eq_hl_5'
  No such file or directory (os error 2)
...
error: doctest failed, to rerun pass `-p uucore --doc`

The following extern location ... does not exist errors are cascading from this failure. The main test suite completed successfully (5915 passed; 0 failed).

Reason

This is the known uucore test-directory race: the parallel filesystem tests create and remove temporary directories under src/uucore (here uucore_fs_test_eq_hl_5) while Cargo scans that package to compute the build-script fingerprint, so Cargo sees a directory that has already disappeared. The failure is in the uucore build/doctest setup, not in this PR's files (src/uu/unexpand/src/unexpand.rs, tests/by-util/test_unexpand.rs); there is no compilation error or assertion pointing to the unexpand change. This is unrelated to this PR and should be resolved by rerunning the job.

@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 (126116058049) failed in test_tail::test_follow_symlink_appends:

test test_tail::test_follow_symlink_appends ... FAILED
thread 'test_tail::test_follow_symlink_appends' panicked at tests/by-util/test_tail.rs:5564:14:
assertion failed: (left == right)
test result: FAILED. 5981 passed; 1 failed; 69 ignored; 0 measured; 0 filtered out; finished in 415.09s

Reason

This is the known intermittent failure tracked in #15568 on the macOS PGO runner. It is unrelated to the unexpand changes in this PR. Please rerun the job.

@cakebaker
cakebaker merged commit 81572a4 into uutils:main Nov 6, 2026
139 of 141 checks passed
@cakebaker

Copy link
Copy Markdown
Contributor

Thanks!

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.

unexpand: --first-only given twice is rejected

3 participants