Skip to content

dd: extend a sparse output before syncing it - #16641

Open
yunusarda-sudo wants to merge 1 commit into
uutils:mainfrom
yunusarda-sudo:dd-extend-sparse-before-sync
Open

yunusarda-sudo wants to merge 1 commit into
uutils:mainfrom
yunusarda-sudo:dd-extend-sparse-before-sync

Conversation

@yunusarda-sudo

Copy link
Copy Markdown

With conv=sparse,fsync (or fdatasync), a trailing zero block is skipped and the file is grown with set_len() only after the sync, so the final length change is outside the requested synchronization. GNU dd extends the file first and then syncs.

finalize() now calls extend_sparse() before sync(). Added a Linux test that runs dd under strace (skipped when strace is missing or tracing isn't allowed, like the existing shred test) and checks that the final ftruncate comes before fsync/fdatasync.

Closes #16552

@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Binary size comparison:

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

Total size of compared binaries: 155.48 MB (+100 KB, +0.06%)

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

@yunusarda-sudo
yunusarda-sudo force-pushed the dd-extend-sparse-before-sync branch from 773be17 to e677211 Compare November 18, 2026 16:32
Comment thread tests/by-util/test_dd.rs
Comment on lines +1582 to +1583
#[cfg(target_os = "linux")]
#[cfg(not(wasi_runner))]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the cfg above the #[rstest], and turn the wasi_runner cfg into a #[uutests::wasi_ignore(reason)] with the right reason (to be choosed among the choices in tests/uutests_procs/src/lib.rs)

@yunusarda-sudo
yunusarda-sudo force-pushed the dd-extend-sparse-before-sync branch from e677211 to 7d5ff17 Compare November 19, 2026 18:52

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.

dd: conv=sparse updates the final file size after fsync/fdatasync

2 participants