Skip to content

cut: preserve partial records when an input read fails - #17069

Open
limadog9 wants to merge 1 commit into
uutils:mainfrom
limadog9:fix/cut-input-read-errors
Open

limadog9 wants to merge 1 commit into
uutils:mainfrom
limadog9:fix/cut-input-read-errors

Conversation

@limadog9

@limadog9 limadog9 commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Finish the current record with the bytes already read, report the failing input, and continue with later operands. This prevents cut from dropping selected text or joining records across files. On Linux and Android, report the actual directory read error.

Both cut checks in GNU 9.12's misc/read-errors.sh now pass. The script went from 36 failures to 34. All four dedicated GNU cut tests passed before and after. All 92 Linux integration tests and 22 unit tests passed.

Addresses the cut portion of #10890 and #14705.

@codspeed

codspeed Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will improve performance by 15.68%

1 warning

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

⚡ 2 improved benchmarks
✅ 10 untouched benchmarks
⏩ 490 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
⚡ CPU Simulation cut_characters_long_lines 40.8 ms 32.2 ms +26.98%
⚡ CPU Simulation cut_bytes 15.9 ms 15.1 ms +5.38%

Tip

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


Comparing limadog9:fix/cut-input-read-errors (4694641) with main (48819c9)

Open in CodSpeed

Footnotes

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

Let each selection mode finish the bytes already read before reporting the error against the input operand. Continue with later operands, including another read from standard input. On Linux and Android use the read error for directories.
@limadog9
limadog9 force-pushed the fix/cut-input-read-errors branch from 418a158 to 4694641 Compare December 1, 2026 20:20

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.

1 participant