From b119a5a283c892437795b5435b4f3761ec782bd7 Mon Sep 17 00:00:00 2001 From: snek Date: Thu, 18 Jul 2024 08:29:05 -0700 Subject: [PATCH] fix: linux canonicalization checks --- ext/fs/std_fs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs index 3cbd154d599670..d8d5f650279e68 100644 --- a/ext/fs/std_fs.rs +++ b/ext/fs/std_fs.rs @@ -1069,8 +1069,10 @@ fn open_with_access_check( }; (*access_check)(false, &path, &options)?; // On Linux, /proc may contain magic links that we don't want to resolve - let needs_canonicalization = !is_windows_device_path - && (!cfg!(target_os = "linux") || path.starts_with("/proc")); + let is_linux_special_path = cfg!(target_os = "linux") + && (path.starts_with("/proc") || path.starts_with("/dev")); + let needs_canonicalization = + !is_windows_device_path && !is_linux_special_path; let path = if needs_canonicalization { match path.canonicalize() { Ok(path) => path,