-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inotify watch on config file should include IN_CREATE #2210
Comments
When the config file does not exist, we have a watch on the containing directory - have you been able to figure out why this is not enough? |
correct if I am wrong but a symlink does not directly overwrite or modify the file system in the sense of overwriting data on disk, it updates the symbolic link to point the new target file, in most cases inotify monitors the file descriptor not the filename, so symlink for a new file is like no changes |
If the config file is a symlink, wayfire attempts to watch the parent directory so that, if replaced via a subsequent `ln -sf`, it'll still be notified. When notified, however, wayfire doesn't immediately reload the config file. Rather, as this event may be triggered by any file creation in the directory, we first make sure that the config file really is the one being created anew. The filename from inotify is stored as a flexible array member in the event struct, though, and this was somehow causing problems when compared with the known std::string basename. Fixes WayfireWM#2210.
If the config file is a symlink, wayfire attempts to watch the parent directory so that, if replaced via a subsequent `ln -sf`, it'll still be notified. When notified, however, wayfire doesn't immediately reload the config file. Rather, as this event may be triggered by any file creation in the directory, we first make sure that the config file really is the one being created anew. Unfortunately, ln -sf is special: It'll create a randomly named file in the directory before renameat(2)ing it to the proper location. So it does generate an IN_CREATE event, but to know that the file was changed, we need to additionally monitor for IN_MOVED_TO. Fixes WayfireWM#2210.
If the config file is a symlink, wayfire attempts to watch the parent directory so that, if replaced via a subsequent `ln -sf`, it'll still be notified. When notified, however, wayfire doesn't immediately reload the config file. Rather, as this event may be triggered by any file creation in the directory, we first make sure that the config file really is the one being created anew. Unfortunately, ln -sf is special: It'll create a randomly named file in the directory before renameat(2)ing it to the proper location. So it does generate an IN_CREATE event, but to know that the file was changed, we need to additionally monitor for IN_MOVED_TO. Fixes WayfireWM#2210.
Describe the bug
Currently, Wayfire will fail to automatically reload the config if that config is replaced by a new file (e.g., if it's a symlink). This causes difficulty specifically with NixOS and home-manager, where, to keep the config reproducible, it's symlinked in from the nix store. This is likely caused by inotify only watching the config for IN_CLOSE_WRITE events when a more liberal selection would be more appropriate.
To Reproduce
Write a config file, and symlink it to
~/.config/wayfire.ini
or similar. Start wayfire. Write a new config file, and symlink (-f
) that new file into~/.config/wayfire.ini
. Observe that wayfire does not reload the config.Expected behavior
Wayfire should reload the config regardless of how it's updated.
Wayfire version
0.8.0. A cursory glance at git makes me think that this is still an issue.
Thanks so much! (By the way, my apologies if I've made a mistake reporting this; it's late here!)
The text was updated successfully, but these errors were encountered: