Skip to content
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

Do not suppress Chmod on non-existent file #260

Merged
merged 1 commit into from Jul 21, 2022

Commits on Jul 21, 2022

  1. Do not suppress Chmod on non-existent file

    Currently fsnotify suppresses a Chmod event if the file does not exist
    when the event is received.
    
    This makes it impossible to use fsnotify to detect when an opened file
    is removed. In such case the Linux kernel sends IN_ATTRIB event,
    as described in inotify(7) man page:
    
    > IN_ATTRIB (*)
    >        Metadata  changed—for example, permissions (e.g., chmod(2)),
    >        timestamps (e.g., utimensat(2)), extended attributes  (setx‐
    >        attr(2)), link count (since Linux 2.6.25; e.g., for the tar‐
    >        get of link(2) and for unlink(2)), and user/group ID  (e.g.,
    >        chown(2)).
    
    (to clarify, in this very case it's link count that changes).
    
    To fix:
     * Modify the code to only suppress MODIFY and CREATE events.
     * Add a test case to verify Chmod event is delivered.
    
    While at it, fix the comment in ignoreLinux() to use the up-to-date
    terminology (event ops).
    
    A test case is added.
    
    Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
    kolyshkin authored and arp242 committed Jul 21, 2022
    Copy the full SHA
    53832bc View commit details
    Browse the repository at this point in the history