Skip to content

dd: name the failing operation and count the read that failed to write - #14071

Open
igorgbr wants to merge 5 commits into
uutils:mainfrom
igorgbr:dd/report-stats-on-io-error
Open

dd: name the failing operation and count the read that failed to write#14071
igorgbr wants to merge 5 commits into
uutils:mainfrom
igorgbr:dd/report-stats-on-io-error

Conversation

@igorgbr

@igorgbr igorgbr commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Follow-up to eb7f437, which made a failed copy report its statistics.

Two differences from GNU remained: when the write fails, the block that was
read is dropped instead of counted, so records in is one short; and the
message is IO error: <errno>, without the operation or the file.

$ dd if=/dev/zero of=/dev/full bs=1024 count=100
before: 0+0 records in / dd: IO error: No space left on device
after:  1+0 records in / dd: error writing '/dev/full': No space left on device
GNU:    1+0 records in / dd: error writing '/dev/full': No space left on device

dd_copy now returns UResult so the error carries the operation and the
file name; the existing ? paths keep the old generic context.

Refs #13092.

A failed copy reported `IO error: <errno>` without saying whether the read or the write failed, or on which file. It also dropped the record that had been read when the write failed, so `records in` was one short.
@codspeed-hq

codspeed-hq Bot commented Aug 21, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 3.77%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 5 regressed benchmarks
✅ 13 untouched benchmarks
⏩ 390 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Simulation dd_copy_default 32.2 ms 33.6 ms -4.21%
Simulation dd_copy_4k_blocks 2.5 ms 2.7 ms -3.86%
Simulation dd_copy_with_seek 4.8 ms 5 ms -3.76%
Simulation dd_copy_with_skip 4.7 ms 4.9 ms -3.69%
Simulation dd_copy_8k_blocks 1.8 ms 1.9 ms -3.35%

Tip

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


Comparing igorgbr:dd/report-stats-on-io-error (22df584) with main (1a6fb19)2

Open in CodSpeed

Footnotes

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

@github-actions

github-actions Bot commented Aug 22, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/cut/bounded-memory (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/dd/no-allocate is now passing!

@igorgbr

igorgbr commented Aug 24, 2026

Copy link
Copy Markdown
Contributor Author

The remaining CI failure on windows-latest, i686-pc-windows-msvc is in test_tail::test_follow_name_truncate1, which seems unrelated to this PR (it changes dd, not tail). All other checks, including the dd benchmarks and GNU tests, passed.

It looks like a flaky test, but I don't have permission to re-run the job.

Could someone with access re-run it or advise if anything else is needed? Thanks!

igorgbr and others added 3 commits August 26, 2026 14:14
Also renames the test directory to a word cspell already knows, so the workspace dictionary does not need an entry.
@igorgbr

igorgbr commented Aug 26, 2026

Copy link
Copy Markdown
Contributor Author

None of the GnuTests regressions come from this PR:

  • tests/dd/misc — the failing case is dd count=00x<huge>. GNU stops at the
    zero factor and reports 0+0 records in; we now reject the huge factor first:

    $ dd count=00x99999999999999999999999999999999999999999999999999999999
    uutils: dd: invalid number: '00x999…': Value too large for defined data type
    GNU:    0+0 records in / 0+0 records out
    

That comes from 7f9b9a6 ("dd: reject a number that does not fit in u64"),
which changed SizeTooBig from u64::MAX into an error. It reached this
branch through the merge with main src/uu/dd/src/parseargs.rs is
byte-identical to main here, and this PR touches only dd.rs, the .ftl and
the tests. Filed separately as #14160.

  • tests/dd/fail-ftruncate-fstat — was skipped on main and now runs. It fails
    on an fstat error message, a path this PR deliberately leaves with the old
    generic context.

  • tests/df/over-mount-device is unrelated to dd.

tests/dd/partial-write now passes.

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.

2 participants