From ea88a40c8fd8bcf78fb70366999968e4fa80934b Mon Sep 17 00:00:00 2001 From: artemws <59208085+artemws@users.noreply.github.com> Date: Fri, 20 Feb 2026 15:37:44 +0200 Subject: [PATCH] Add config path canonicalization Canonicalize the config path to match notify events. --- src/config/hot_reload.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/config/hot_reload.rs b/src/config/hot_reload.rs index 8278312..246f8a3 100644 --- a/src/config/hot_reload.rs +++ b/src/config/hot_reload.rs @@ -319,6 +319,13 @@ pub fn spawn_config_watcher( // Bridge: sync notify callback → async task via mpsc. let (notify_tx, mut notify_rx) = mpsc::channel::<()>(4); + // Canonicalize the config path so it matches what notify returns in events + // (notify always gives absolute paths, but config_path may be relative). + let config_path = match config_path.canonicalize() { + Ok(p) => p, + Err(_) => config_path.to_path_buf(), // file doesn't exist yet, use as-is + }; + // Watch the parent directory rather than the file itself, because many // editors (vim, nano, systemd-sysusers) write via rename, which would // cause inotify to lose track of the original inode.