Skip to content

Comments

touch: fix inotify compatibility by avoiding O_TRUNC#11052

Draft
sylvestre wants to merge 1 commit intouutils:mainfrom
sylvestre:inotify
Draft

touch: fix inotify compatibility by avoiding O_TRUNC#11052
sylvestre wants to merge 1 commit intouutils:mainfrom
sylvestre:inotify

Conversation

@sylvestre
Copy link
Contributor

Replace File::create() with OpenOptions::new().create_new(true) to avoid the O_TRUNC flag that interferes with inotify file change detection.

The O_TRUNC flag in file creation was causing issues with applications like 0 A.D. that monitor configuration files for changes using inotify. The new implementation uses O_EXCL instead, which is safer and doesn't interfere with inotify event generation.

closes: #9812

Replace File::create() with OpenOptions::new().create_new(true) to avoid
the O_TRUNC flag that interferes with inotify file change detection.

The O_TRUNC flag in file creation was causing issues with applications
like 0 A.D. that monitor configuration files for changes using inotify.
The new implementation uses O_EXCL instead, which is safer and doesn't
interfere with inotify event generation.

closes: uutils#9812
@github-actions
Copy link

GNU testsuite comparison:

GNU test failed: tests/touch/dangling-symlink. tests/touch/dangling-symlink is passing on 'main'. Maybe you have to rebase?
Skip an intermittent issue tests/pr/bounded-memory (fails in this run but passes in the 'main' branch)

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.

touch doesn't trigger IN_CLOSE_WRITE on Linux (breaks inotify-based reloaders)

1 participant