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 <d.csapak@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
This commit is contained in:
Fabian Ebner 2022-03-28 13:11:03 +02:00 committed by Thomas Lamprecht
parent 48fcee6a50
commit 2b323a359d
1 changed files with 2 additions and 1 deletions

View File

@ -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(());