1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 07:14:47 -05:00

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.
-->
This commit is contained in:
snek 2024-09-10 12:35:41 -07:00 committed by GitHub
parent 7bfcb4dd10
commit ee3829a778
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1069,8 +1069,10 @@ fn open_with_access_check(
}; };
(*access_check)(false, &path, &options)?; (*access_check)(false, &path, &options)?;
// On Linux, /proc may contain magic links that we don't want to resolve // On Linux, /proc may contain magic links that we don't want to resolve
let needs_canonicalization = !is_windows_device_path let is_linux_special_path = cfg!(target_os = "linux")
&& (!cfg!(target_os = "linux") || path.starts_with("/proc")); && (path.starts_with("/proc") || path.starts_with("/dev"));
let needs_canonicalization =
!is_windows_device_path && !is_linux_special_path;
let path = if needs_canonicalization { let path = if needs_canonicalization {
match path.canonicalize() { match path.canonicalize() {
Ok(path) => path, Ok(path) => path,