From b36bc7dd6fe39bf0aa62b9acc959203bee940c56 Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Sun, 21 Jun 2026 00:42:57 +0800 Subject: [PATCH 1/2] Revert "Better store validation" This reverts commit 88992f80a0f63e143ea173509bef51754fba084e. --- angrr/src/utils.rs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/angrr/src/utils.rs b/angrr/src/utils.rs index db1a0b2..df43152 100644 --- a/angrr/src/utils.rs +++ b/angrr/src/utils.rs @@ -15,9 +15,16 @@ pub fn validate_store_path, P2: AsRef>( store: P1, target: P2, ) -> Option { + let store = store.as_ref(); let target = target.as_ref(); - match canonicalize_to_store(store, target) { - Ok(path) => Some(path), + match fs::canonicalize(target) { + Ok(path) => { + if path.starts_with(store) { + Some(path) + } else { + None + } + } Err(e) => { log::warn!("failed to canonicalize {target:?} for validation: {e}"); None @@ -25,25 +32,6 @@ pub fn validate_store_path, P2: AsRef>( } } -pub fn canonicalize_to_store, P2: AsRef>( - store: P1, - path: P2, -) -> anyhow::Result { - let store = store.as_ref(); - let path = path.as_ref(); - if path.starts_with(store) { - Ok(PathBuf::from(path)) - } else { - let metadata = fs::symlink_metadata(path)?; - if metadata.is_symlink() { - let next = fs::read_link(path)?; - canonicalize_to_store(store, next) - } else { - anyhow::bail!("canonicalized to a non-store path") - } - } -} - pub fn discover_users(roots: &[Arc]) -> anyhow::Result> { let uids: BTreeSet<_> = roots.iter().map(|root| root.path_metadata.uid()).collect(); let mut users = Vec::new(); From 8f122c278a8287731e028bfb185964f633bc486f Mon Sep 17 00:00:00 2001 From: Lin Yinfeng Date: Sun, 21 Jun 2026 00:49:30 +0800 Subject: [PATCH 2/2] Suppress annoying logs in store path validation 88992f80a0f63e143ea173509bef51754fba084e has some problems: 1. Relative symlinks are not resolved correctly 2. There is no cycle detection (symbolic links can be recursive) --- angrr/src/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/angrr/src/utils.rs b/angrr/src/utils.rs index df43152..e1cd68c 100644 --- a/angrr/src/utils.rs +++ b/angrr/src/utils.rs @@ -26,7 +26,7 @@ pub fn validate_store_path, P2: AsRef>( } } Err(e) => { - log::warn!("failed to canonicalize {target:?} for validation: {e}"); + log::debug!("failed to canonicalize {target:?} for validation: {e}"); None } }