diff options
author | Ryan Lahfa <tvl@lahfa.xyz> | 2024-01-20T20·11+0100 |
---|---|---|
committer | raitobezarius <tvl@lahfa.xyz> | 2024-01-22T14·15+0000 |
commit | 68bba48d592c0b30b617642cbe5b1cda758b0272 (patch) | |
tree | bea8cf6093431576999205de1d9ca9c84f5b9068 /tvix/castore/src | |
parent | 0ae751a89f1926d509fcdbc3bb0b9c460839b8f1 (diff) |
feat(tvix/castore): `process_entry` cannot process unsupported nodes r/7437
In the past, we had a `todo!` on unsupported node types, this returns a proper error that can be caught by the caller. Change-Id: Icba4c1dab33c0d670a97f162c9b358d1ed5855cb Reviewed-on: https://cl.tvl.fyi/c/depot/+/10675 Tested-by: BuildkiteCI Reviewed-by: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/castore/src')
-rw-r--r-- | tvix/castore/src/import.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/tvix/castore/src/import.rs b/tvix/castore/src/import.rs index 1c99df480d14..f7677e63142d 100644 --- a/tvix/castore/src/import.rs +++ b/tvix/castore/src/import.rs @@ -10,7 +10,11 @@ use crate::Error as CastoreError; use async_stream::stream; use futures::pin_mut; use futures::Stream; +use std::fs::FileType; + +#[cfg(target_family = "unix")] use std::os::unix::ffi::OsStrExt; + use std::{ collections::HashMap, fmt::Debug, @@ -41,6 +45,9 @@ pub enum Error { #[error("unable to read {0}: {1}")] UnableToRead(PathBuf, std::io::Error), + + #[error("unsupported file {0} type: {1:?}")] + UnsupportedFileType(PathBuf, FileType), } impl From<CastoreError> for Error { @@ -145,7 +152,12 @@ where executable: metadata.permissions().mode() & 64 != 0, })); } - todo!("handle other types") + + // Nix says things like: error: file '/home/raito/dev/code.tvl.fyi/tvix/glue/src/tests/import_fixtures/a_devnode' has an unsupported type + Err(Error::UnsupportedFileType( + entry.path().to_path_buf(), + file_type, + )) } /// Walk the filesystem at a given path and returns a level-keyed list of directory entries. |