From 2b323a359d4ab3ccb9211b101ae1eb37cd72cd8d Mon Sep 17 00:00:00 2001 From: Fabian Ebner Date: Mon, 28 Mar 2022 13:11:03 +0200 Subject: [PATCH] pxar: create: add entry: fix anchored path pattern matching Similar to 874bd545 ("pxar: fix anchored exclusion at archive root"), but this time for inclusion. Because of the inconsistency, it could happen that a file included in generate_directory_file_list() got excluded in add_entry(), e.g. with a .pxarexclude file like > * > !/supposed-to-be-included Reported-by: Dominik Csapak Signed-off-by: Fabian Ebner --- pbs-client/src/pxar/create.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs index 9f3b0576..8dcb192d 100644 --- a/pbs-client/src/pxar/create.rs +++ b/pbs-client/src/pxar/create.rs @@ -549,9 +549,10 @@ impl Archiver { let metadata = get_metadata(fd.as_raw_fd(), stat, self.flags(), self.fs_magic, &mut self.fs_feature_flags)?; + let match_path = PathBuf::from("/").join(self.path.clone()); if self .patterns - .matches(self.path.as_os_str().as_bytes(), Some(stat.st_mode as u32)) + .matches(match_path.as_os_str().as_bytes(), Some(stat.st_mode as u32)) == Some(MatchType::Exclude) { return Ok(());