From 6d538c70add3047e0c0753c238a27a0b96c15323 Mon Sep 17 00:00:00 2001 From: trivernis Date: Sat, 11 Mar 2023 17:06:28 +0100 Subject: [PATCH] Improve chrooting error messages --- src/error.rs | 2 +- src/main.rs | 2 +- src/task/chrooting/mapping.rs | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/error.rs b/src/error.rs index 90e3b70..c461b70 100644 --- a/src/error.rs +++ b/src/error.rs @@ -112,7 +112,7 @@ pub enum ChrootError { #[diagnostic(code(trm::chroot::mount))] Mount(PathBuf, io::Error), - #[error("Failed to create symlink {0} in chroot: {1}")] + #[error("Failed to create symlink to {0} in chroot: {1}")] #[diagnostic(code(trm::chroot::symlink))] Link(PathBuf, io::Error), diff --git a/src/main.rs b/src/main.rs index 5e160ca..26dbfde 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,7 @@ mod args; async fn main() -> miette::Result<()> { miette::set_panic_hook(); color_eyre::install().unwrap(); - dotenv::dotenv().unwrap(); + let _ = dotenv::dotenv(); let args = Args::parse(); match args.command { diff --git a/src/task/chrooting/mapping.rs b/src/task/chrooting/mapping.rs index 2650030..7ec2764 100644 --- a/src/task/chrooting/mapping.rs +++ b/src/task/chrooting/mapping.rs @@ -142,9 +142,9 @@ impl Mapping { } fs::symlink(src, dst) .await - .map_err(|e| ChrootError::Link(dst.to_owned(), e))?; + .map_err(|e| ChrootError::Link(src.to_owned(), e))?; Ok(MappingHandle::Link(LinkDrop { - path: dst.to_owned(), + path: src.to_owned(), })) } @@ -152,12 +152,12 @@ impl Mapping { if dst.exists() && dst.is_file() { fs::remove_file(dst) .await - .map_err(|e| ChrootError::Copy(dst.to_owned(), e))?; + .map_err(|e| ChrootError::Copy(src.to_owned(), e))?; } fs::copy(src, dst) .await - .map_err(|e| ChrootError::Copy(dst.to_owned(), e))?; + .map_err(|e| ChrootError::Copy(src.to_owned(), e))?; Ok(MappingHandle::None) }