From e1255cf81dea0522d6ce6dffba4dd6d286f72b05 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 17 Oct 2025 14:01:44 +0200 Subject: [PATCH 1/4] fix: Use fully qualified path in test macro. --- arx/tests/utils/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arx/tests/utils/mod.rs b/arx/tests/utils/mod.rs index 01e632f..7f16c19 100644 --- a/arx/tests/utils/mod.rs +++ b/arx/tests/utils/mod.rs @@ -393,7 +393,7 @@ macro_rules! join { }; (@init, $first:expr, $($args:tt),+) => { { - let mut path:PathBuf = AsRef::::as_ref(&$first).to_path_buf(); + let mut path:std::path::PathBuf = std::convert::AsRef::::as_ref(&$first).to_path_buf(); join!(@append, path, $($args),+); path } From 4da1e890bf2d18cfab3782c6200011f271ea8af6 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 17 Oct 2025 14:06:38 +0200 Subject: [PATCH 2/4] fix: Better error message in case of incoherentrtruct error. --- libarx/src/create/entry_store_creator.rs | 28 ++++++++++++++---------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/libarx/src/create/entry_store_creator.rs b/libarx/src/create/entry_store_creator.rs index 64ba1fe..05f1b38 100644 --- a/libarx/src/create/entry_store_creator.rs +++ b/libarx/src/create/entry_store_creator.rs @@ -85,9 +85,10 @@ impl DirEntry { let mut write_children = self.children.try_write().unwrap(); match write_children.get_mut(component.as_str()).unwrap() { DirOrFile::Dir(e) => e.add(entry, components, entry_store), - DirOrFile::File(_) => Err(IncoherentStructure( - "Cannot add a entry to something which is not a directory".into(), - ) + DirOrFile::File(_) => Err(IncoherentStructure(format!( + "Adding {}, cannot add a entry to something which is not a directory", + entry.path() + )) .into()), } } @@ -172,9 +173,10 @@ impl DirEntry { match self.children.try_read().unwrap().get(entry_name) { Some(DirOrFile::Dir(_)) => return Ok(()), Some(DirOrFile::File(_)) => { - return Err(IncoherentStructure( - "Cannot add a dir when file or link already exists".into(), - ) + return Err(IncoherentStructure(format!( + "Adding {}, cannot add a dir when file or link already exists", + entry.path() + )) .into()) } None => {} @@ -208,9 +210,10 @@ impl DirEntry { } EntryKind::File(size, content_address) => { if self.children.try_read().unwrap().contains_key(entry_name) { - return Err(IncoherentStructure( - "Cannot add a file when one already exists".into(), - ) + return Err(IncoherentStructure(format!( + "Adding {}, cannot add a file when one already exists", + entry.path() + )) .into()); } values.insert(Property::Content, jbk::Value::Content(content_address)); @@ -229,9 +232,10 @@ impl DirEntry { } EntryKind::Link(target) => { if self.children.try_read().unwrap().contains_key(entry_name) { - return Err(IncoherentStructure( - "Cannot add a link when one already exists".into(), - ) + return Err(IncoherentStructure(format!( + "Adding {}, cannot add a link when one already exists", + entry.path() + )) .into()); } values.insert( From 93d6cd6595fe0da3b9d8a15c01cc4065956807a9 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 17 Oct 2025 14:07:00 +0200 Subject: [PATCH 3/4] chore: Fix warnings. --- python/src/entry.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/src/entry.rs b/python/src/entry.rs index 17386bc..9ebb413 100644 --- a/python/src/entry.rs +++ b/python/src/entry.rs @@ -160,7 +160,7 @@ impl Entry { /// Get the link target of the link entry. /// /// Raise an exception if entry is not a link. - fn get_target(&self) -> PyResult> { + fn get_target(&self) -> PyResult> { match &self.entry { arx::Entry::Link(l) => Ok(l.target().into()), _ => Err(PyTypeError::new_err("Not a link")), From 5a3a76f5bf8d7480dbbe3863c70e7e7e2cbcb5d8 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 17 Oct 2025 14:07:25 +0200 Subject: [PATCH 4/4] fix: Also configure log level for libarx module. --- arx/src/main.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arx/src/main.rs b/arx/src/main.rs index 04b1e88..21d08e1 100644 --- a/arx/src/main.rs +++ b/arx/src/main.rs @@ -85,6 +85,15 @@ fn configure_log(verbose: u8) { _ => log::LevelFilter::Trace, }, ) + .filter_module( + "libarx", + match verbose { + 0 => log::LevelFilter::Warn, + 1 => log::LevelFilter::Info, + 2 => log::LevelFilter::Debug, + _ => log::LevelFilter::Trace, + }, + ) .format_module_path(false) .format_timestamp(None) .init();