diff --git a/tvix/eval/src/io.rs b/tvix/eval/src/io.rs index 9acfd6eeb..abe0e0518 100644 --- a/tvix/eval/src/io.rs +++ b/tvix/eval/src/io.rs @@ -98,7 +98,8 @@ pub struct StdIO; #[cfg(feature = "impure")] impl EvalIO for StdIO { fn path_exists(&self, path: &Path) -> io::Result { - path.try_exists() + // In general, an IO error indicates the path doesn't exist + Ok(path.try_exists().unwrap_or(false)) } fn open(&self, path: &Path) -> io::Result> { diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.exp b/tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.exp new file mode 100644 index 000000000..c508d5366 --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.exp @@ -0,0 +1 @@ +false diff --git a/tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.nix b/tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.nix new file mode 100644 index 000000000..8588f0bdd --- /dev/null +++ b/tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.nix @@ -0,0 +1 @@ +builtins.pathExists ("/dev/null/.") \ No newline at end of file