summaryrefslogtreecommitdiff
path: root/ext/fs
diff options
context:
space:
mode:
authorsnek <snek@deno.com>2024-09-10 12:35:41 -0700
committerGitHub <noreply@github.com>2024-09-10 12:35:41 -0700
commitee3829a7787b337b2a7e98251b40d5937b2c255b (patch)
tree9cbb0488cbf354488544091e8dac05e42f794371 /ext/fs
parent7bfcb4dd10d31f5f9566c90a28449c0951f3a48e (diff)
fix: linux canonicalization checks (#24641)
<!-- Before submitting a PR, please read https://docs.deno.com/runtime/manual/references/contributing 1. Give the PR a descriptive title. Examples of good title: - fix(std/http): Fix race condition in server - docs(console): Update docstrings - feat(doc): Handle nested reexports Examples of bad title: - fix #7123 - update docs - fix bugs 2. Ensure there is a related issue and it is referenced in the PR text. 3. Ensure there are tests that cover the changes. 4. Ensure `cargo test` passes. 5. Ensure `./tools/format.js` passes without changing files. 6. Ensure `./tools/lint.js` passes. 7. Open as a draft PR if your work is still in progress. The CI won't run all steps, but you can add '[ci]' to a commit message to force it to. 8. If you would like to run the benchmarks on the CI, add the 'ci-bench' label. -->
Diffstat (limited to 'ext/fs')
-rw-r--r--ext/fs/std_fs.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/fs/std_fs.rs b/ext/fs/std_fs.rs
index 3cbd154d5..d8d5f6502 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,