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

Copy link
Copy Markdown

Binary size comparison:

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

Total size of compared binaries: 155.49 MB (+108 KB, +0.07%)

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

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

1 participant