about summary refs log tree commit diff
path: root/tvix/store/src/import.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-09-05T14·08+0300
committerclbot <clbot@tvl.fyi>2023-09-05T15·19+0000
commit7bd3c42c747498dea657e0ed26ed5ec2a9eddda3 (patch)
treec4e4800c3c3e11a600e6d2893d9149f69a85f0ee /tvix/store/src/import.rs
parente187a7bcb18ade669e276473b277edcd01f1babb (diff)
chore(tvix/store): drop walkdir workaround for symlinks at root r/6553
https://github.com/BurntSushi/walkdir/pull/170 got merged, meaning we
don't need to keep our own logic in here anymore.

Our test cases already cover this.

Change-Id: Ied3043ee651c8aafa10271c1e1ca5d460fb6c0b8
Reviewed-on: https://cl.tvl.fyi/c/depot/+/9269
Autosubmit: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
Reviewed-by: tazjin <tazjin@tvl.su>
Diffstat (limited to 'tvix/store/src/import.rs')
-rw-r--r--tvix/store/src/import.rs24
1 files changed, 4 insertions, 20 deletions
diff --git a/tvix/store/src/import.rs b/tvix/store/src/import.rs
index cb645a6e2e3c..cd3dc01cfe0a 100644
--- a/tvix/store/src/import.rs
+++ b/tvix/store/src/import.rs
@@ -6,7 +6,6 @@ use std::sync::Arc;
 use std::{
     collections::HashMap,
     fmt::Debug,
-    fs,
     fs::File,
     io,
     os::unix::prelude::PermissionsExt,
@@ -130,6 +129,9 @@ fn process_entry(
 /// interacting with a [BlobService] and [DirectoryService].
 /// It returns the root node or an error.
 ///
+/// It does not follow symlinks at the root, they will be ingested as actual
+/// symlinks.
+///
 /// It's not interacting with a
 /// [PathInfoService](crate::pathinfoservice::PathInfoService), it's up to the
 /// caller to possibly register it somewhere (and potentially rename it based on
@@ -140,25 +142,6 @@ pub fn ingest_path<P: AsRef<Path> + Debug>(
     directory_service: Arc<dyn DirectoryService>,
     p: P,
 ) -> Result<proto::node::Node, Error> {
-    // Probe if the path points to a symlink. If it does, we process it manually,
-    // due to https://github.com/BurntSushi/walkdir/issues/175.
-    let symlink_metadata = fs::symlink_metadata(p.as_ref())
-        .map_err(|e| Error::UnableToStat(p.as_ref().to_path_buf(), e))?;
-    if symlink_metadata.is_symlink() {
-        let target = std::fs::read_link(p.as_ref())
-            .map_err(|e| Error::UnableToStat(p.as_ref().to_path_buf(), e))?;
-        return Ok(proto::node::Node::Symlink(proto::SymlinkNode {
-            name: p
-                .as_ref()
-                .file_name()
-                .unwrap_or_default()
-                .as_bytes()
-                .to_owned()
-                .into(),
-            target: target.as_os_str().as_bytes().to_vec().into(),
-        }));
-    }
-
     let mut directories: HashMap<PathBuf, proto::Directory> = HashMap::default();
 
     // TODO: pass this one instead?
@@ -166,6 +149,7 @@ pub fn ingest_path<P: AsRef<Path> + Debug>(
 
     for entry in WalkDir::new(p)
         .follow_links(false)
+        .follow_root_links(false)
         .contents_first(true)
         .sort_by_file_name()
     {