From 0657a55b3d0a22b4bdb2185d3092c62ddd96f708 Mon Sep 17 00:00:00 2001 From: Matteo Settenvini Date: Fri, 21 Feb 2025 00:16:06 +0100 Subject: [PATCH 1/2] fix: always canonicalize paths, remove temporary debug statements --- src/cleaners.rs | 4 ++-- src/cleaners/dso.rs | 5 ----- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/cleaners.rs b/src/cleaners.rs index f6c8f08..925937e 100644 --- a/src/cleaners.rs +++ b/src/cleaners.rs @@ -82,14 +82,14 @@ impl Runner { async fn paths_producer(tasks: &mut JoinSet>) -> mpsc::Receiver { let (input_tx, input_rx) = mpsc::channel(CHANNEL_SIZE); - let walker = WalkDir::new(".").follow_links(false); + let walker = WalkDir::new(".").follow_links(false).same_file_system(true); tasks.spawn(async move { for entry in walker { match entry { Ok(e) if !Self::is_dir(&e) => { input_tx .send(Decision { - path: e.into_path(), + path: e.into_path().strip_prefix(".")?.to_path_buf(), action: Action::Undecided, }) .await?; diff --git a/src/cleaners/dso.rs b/src/cleaners/dso.rs index 965a513..7aea0fe 100644 --- a/src/cleaners/dso.rs +++ b/src/cleaners/dso.rs @@ -77,7 +77,6 @@ impl Cleaner for DsoCleaner { if decision.action == Action::Keep { let ino = nix::sys::stat::lstat(&decision.path)?.st_ino; inodes_to_keep.insert(ino); - dbg!(&decision.path, ino); } // If something was marked as "keep" or "remove" before, @@ -111,10 +110,6 @@ impl Cleaner for DsoCleaner { }; for path in paths { - if path.display().to_string().contains("libjsonrpccpp-server") { - dbg!(inode, &path, action); - } - output.send(Decision { path, action }).await?; } } From 085893c2ef89d8dd28228339ed9e909a3f13bd8b Mon Sep 17 00:00:00 2001 From: Matteo Settenvini Date: Fri, 21 Feb 2025 00:16:31 +0100 Subject: [PATCH 2/2] chore: adopt Rust 2024 --- Cargo.toml | 2 +- rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c2e8436..53bc72a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,7 +5,7 @@ name = "sysroot-cleaner" authors = ["Matteo Settenvini "] version = "0.1.0" -edition = "2021" +edition = "2024" license = "EUPL-1.2" readme = "README.md" diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 41447a0..bd781f6 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -3,6 +3,6 @@ [toolchain] -channel = "1.84" +channel = "1.85" profile = "default" components = ["rustfmt"]