From 6ddcebd23b91c0fd4be9c04fc4c3043fecbbb308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Gonz=C3=A1lez?= Date: Mon, 19 Oct 2026 17:53:57 +0200 Subject: [PATCH] fix(fs): Set proper `inotify` `WatchFlags` values on `libc` backend https://github.com/bytecodealliance/rustix/pull/479 added `inotify` API support to `rustix`, and hardcoded the values of the `EXCL_UNLINK`, `MASK_ADD`, and `MASK_CREATE` `WatchFlags` to 1 for the `libc` backend. This is incorrect and causes the API to silently misbehave when using that backend, because 1 corresponds to the `IN_ACCESS` flag instead, as [the corresponding kernel UAPI definitions show](https://elixir.bootlin.com/linux/v7.2.11/source/include/uapi/linux/inotify.h#L53-L59). However, the `libc` crate has had all the required `inotify` flags since version 0.2.139, which was released a few weeks after PR #479 was submitted: https://github.com/rust-lang/libc/commit/ec6d846cec3174a602877b53522d7d2ad37749fc. `rustix` currently depends on `libc` 0.2.182, which is well above `libc` 0.2.139, so let's take the correct flag definitions from there instead. --- src/backend/libc/fs/inotify.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/backend/libc/fs/inotify.rs b/src/backend/libc/fs/inotify.rs index 89745fb7c..e1f2a96d3 100644 --- a/src/backend/libc/fs/inotify.rs +++ b/src/backend/libc/fs/inotify.rs @@ -62,11 +62,11 @@ bitflags! { /// `IN_DONT_FOLLOW` const DONT_FOLLOW = c::IN_DONT_FOLLOW; /// `IN_EXCL_UNLINK` - const EXCL_UNLINK = 1; + const EXCL_UNLINK = c::IN_EXCL_UNLINK; /// `IN_MASK_ADD` - const MASK_ADD = 1; + const MASK_ADD = c::IN_MASK_ADD; /// `IN_MASK_CREATE` - const MASK_CREATE = 1; + const MASK_CREATE = c::IN_MASK_CREATE; /// `IN_ONESHOT` const ONESHOT = c::IN_ONESHOT; /// `IN_ONLYDIR`