Skip to content

sync: fsync() file operands when no -d/-f flags (GNU MODE_FILE compat) - #14592

Open
lostallmymoney wants to merge 2 commits into
uutils:mainfrom
lostallmymoney:fix-sync-fsync-file-operands
Open

lostallmymoney wants to merge 2 commits into
uutils:mainfrom
lostallmymoney:fix-sync-fsync-file-operands

Conversation

@lostallmymoney

Copy link
Copy Markdown

With file operands and no --data/-d or --file-system/-f flag, GNU sync enters MODE_FILE and fsync()s each operand. uutils instead falls through to a global sync(), silently ignoring the operands and blocking on every filesystem behind initramfs/dracut. Add an fsync(2) path (Linux/Android) mirroring do_fdatasync, and a regression test using /proc/self/mem which rejects fsync() with EINVAL (a global sync() would wrongly exit 0).

Fixes: #14591

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/misc/sync. tests/misc/sync is passing on 'main'. Maybe you have to rebase?
Note: The gnu test tests/expand/bounded-memory is now being skipped but was previously passing.
Congrats! The gnu test tests/cut/bounded-memory is now passing!
Skip an intermittent issue tests/pr/bounded-memory (was skipped on 'main', now failing)

Comment thread tests/by-util/test_sync.rs Outdated
ccmsi and others added 2 commits September 16, 2026 15:09
With file operands and no --data/-d or --file-system/-f flag, GNU sync enters MODE_FILE and fsync()s each operand. uutils instead falls through to a global sync(), silently ignoring the operands and blocking on every filesystem behind initramfs/dracut. Add an fsync(2) path (Linux/Android) mirroring do_fdatasync, and a regression test using /proc/self/mem which rejects fsync() with EINVAL (a global sync() would wrongly exit 0).

Fixes: uutils#14591
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
@lostallmymoney
lostallmymoney force-pushed the fix-sync-fsync-file-operands branch from bb3bc91 to 466fb2b Compare September 16, 2026 19:09
@lostallmymoney

Copy link
Copy Markdown
Author

I'm not an expert in github testing. Is the test failing because it's succeeding or is it really a lack of permissions ahah
The test needs to fail to succeed, to be a regression-prevention-test, idk if that's usually the way things go.

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.

sync FILE hangs because of a USB disk I/O errors, applies global sync for no apparent reasons.

2 participants