[pbs-devel] [PATCH proxmox-backup 1/2] client: pxar: perform match pattern check only once

Christian Ebner c.ebner at proxmox.com
Thu Sep 26 14:34:36 CEST 2024


While traversing the filesystem tree, `generate_directory_file_list`
generates the list of entries to include for each directory level,
already matching the entry against the given list of match patterns.

Since this already excludes entries which should not be included in
the archive, the same check in the `add_entry` call is redundant,
as it is executed for each entry which is included in the list
generated by `generate_directory_file_list`.

Signed-off-by: Christian Ebner <c.ebner at proxmox.com>
---
Seems to be present since commit:
c443f58b09 ("switch to external pxar and fuse crates")

Noticed while looking at the code because an user reported an issue in
the community forum, the issue turned out to be unrelated:
https://forum.proxmox.com/threads/154995/

 pbs-client/src/pxar/create.rs | 9 ---------
 1 file changed, 9 deletions(-)

diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.rs
index c48524c4c..6129f4a44 100644
--- a/pbs-client/src/pxar/create.rs
+++ b/pbs-client/src/pxar/create.rs
@@ -716,15 +716,6 @@ impl Archiver {
             None => return Ok(()),
         };
 
-        let match_path = PathBuf::from("/").join(self.path.clone());
-        if self
-            .patterns
-            .matches(match_path.as_os_str().as_bytes(), stat.st_mode)?
-            == Some(MatchType::Exclude)
-        {
-            return Ok(());
-        }
-
         let metadata = get_metadata(
             fd.as_raw_fd(),
             stat,
-- 
2.39.5





More information about the pbs-devel mailing list