public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] pxar: create: add entry: fix anchored path pattern matching
@ 2022-03-28 11:11 Fabian Ebner
  2022-04-06 15:02 ` [pbs-devel] applied: " Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Ebner @ 2022-03-28 11:11 UTC (permalink / raw)
  To: pbs-devel

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>
---

An alternative would be to remove the path pattern matching from
add_entry() entirely. AFAICT, it's only called with the files generated
by generate_directory_file_list() anyways.

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





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-06 15:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-28 11:11 [pbs-devel] [PATCH proxmox-backup] pxar: create: add entry: fix anchored path pattern matching Fabian Ebner
2022-04-06 15:02 ` [pbs-devel] applied: " Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal