From 0b987a509f189bb0b984c1b306a1b05e928b2296 Mon Sep 17 00:00:00 2001 From: Matthew Tromp Date: Sat, 27 Jul 2024 15:48:05 -0400 Subject: fix(tvix/eval): don't bubble up io errors from path_exists path_exists was returning an error when certain common IO errors were encountered. e.g. in the path "/dev/null/.", path_exists would throw an error because the underlying call to Path::try_exists threw an error because null isn't a directory. But if null isn't a directory, then the path is invalid, so this should really be returning false. That's what nix's behavior is and that's what makes sense. The trait function isn't being changed because some other implementers (e.g. tvix_store_io) have actual errors they can throw. Fixes: b/411 Change-Id: I9e810e7a198bffe61365697c6d3d7e71f264c20b Reviewed-on: https://cl.tvl.fyi/c/depot/+/12042 Tested-by: BuildkiteCI Autosubmit: chickadee Reviewed-by: aspen --- tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.exp | 1 + tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.nix | 1 + 2 files changed, 2 insertions(+) create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.exp create mode 100644 tvix/eval/src/tests/tvix_tests/eval-okay-path-exists-child-of-file.nix (limited to 'tvix/eval/src/tests') 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 000000000000..c508d5366f70 --- /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 000000000000..8588f0bddfc1 --- /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 -- cgit 1.4.1