diff --git a/Cargo.lock b/Cargo.lock index b04d7abd3..cc94083b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4086,6 +4086,7 @@ dependencies = [ "anyhow", "async-trait", "derive_builder_fork_arti", + "fs-mistrust", "futures", "serde", "thiserror", diff --git a/crates/tor-ptmgr/Cargo.toml b/crates/tor-ptmgr/Cargo.toml index 56503d768..d7e186bec 100644 --- a/crates/tor-ptmgr/Cargo.toml +++ b/crates/tor-ptmgr/Cargo.toml @@ -22,6 +22,7 @@ experimental-api = ["visibility"] [dependencies] async-trait = "0.1.2" derive_builder = { version = "0.11.2", package = "derive_builder_fork_arti" } +fs-mistrust = { version = "0.5.1", path = "../fs-mistrust" } futures = "0.3.14" serde = { version = "1.0.103", features = ["derive"] } thiserror = "1" diff --git a/crates/tor-ptmgr/src/err.rs b/crates/tor-ptmgr/src/err.rs index baf7c14ff..0fc632a32 100644 --- a/crates/tor-ptmgr/src/err.rs +++ b/crates/tor-ptmgr/src/err.rs @@ -1,5 +1,6 @@ //! Errors to do with pluggable transports. +use fs_mistrust::anon_home::PathExt as _; use futures::task::SpawnError; use std::path::PathBuf; use std::sync::Arc; @@ -46,7 +47,7 @@ pub enum PtError { #[error("Failed to read from PT binary: {0}")] ChildReadFailed(Arc), /// We couldn't spawn a pluggable transport binary as a child process. - #[error("Couldn't execute PT binary at {}: {}", path.to_string_lossy(), error)] + #[error("Couldn't execute PT binary at {}: {}", path.anonymize_home(), error)] ChildSpawnFailed { /// The binary path we tried to execute. path: PathBuf, @@ -63,7 +64,7 @@ pub enum PtError { error: String, }, /// We couldn't create a state directory. - #[error("Failed to create a state directory at {}: {}", path.to_string_lossy(), error)] + #[error("Failed to create a state directory at {}: {}", path.anonymize_home(), error)] StatedirCreateFailed { /// The offending path. path: PathBuf, @@ -81,7 +82,7 @@ pub enum PtError { error: CfgPathError, }, /// A binary path was a directory or something instead of a file. - #[error("Configured binary path {} isn't a file", path.to_string_lossy())] + #[error("Configured binary path {} isn't a file", path.anonymize_home())] NotAFile { /// The offending path. path: PathBuf,