public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Fabian Ebner <f.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 3/3] pxar: only generate .pxarexclude-cli if there were CLI parameters
Date: Thu, 12 Nov 2020 10:03:52 +0100	[thread overview]
Message-ID: <20201112090352.9268-3-f.ebner@proxmox.com> (raw)
In-Reply-To: <20201112090352.9268-1-f.ebner@proxmox.com>

previously a .pxarexclude entry in the root of the archive caused the file to
be generated as well, because the patterns are read before calling
generate_directory_file_list and within the function it wasn't possible to
distinguish between a pattern coming from the CLI and a pattern coming from
archive/root/.pxarexclude

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/pxar/create.rs | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/src/pxar/create.rs b/src/pxar/create.rs
index 1615a504..c907a8e0 100644
--- a/src/pxar/create.rs
+++ b/src/pxar/create.rs
@@ -237,7 +237,15 @@ impl<'a, 'b> Archiver<'a, 'b> {
         let old_patterns_count = self.patterns.len();
         self.read_pxar_excludes(dir.as_raw_fd())?;
 
-        let file_list = self.generate_directory_file_list(&mut dir, is_root)?;
+        let mut file_list = self.generate_directory_file_list(&mut dir, is_root)?;
+
+        if is_root && old_patterns_count > 0 {
+            file_list.push(FileListEntry {
+                name: CString::new(".pxarexclude-cli").unwrap(),
+                path: PathBuf::new(),
+                stat: unsafe { std::mem::zeroed() },
+            });
+        }
 
         let dir_fd = dir.as_raw_fd();
 
@@ -404,14 +412,6 @@ impl<'a, 'b> Archiver<'a, 'b> {
 
         let mut file_list = Vec::new();
 
-        if is_root && !self.patterns.is_empty() {
-            file_list.push(FileListEntry {
-                name: CString::new(".pxarexclude-cli").unwrap(),
-                path: PathBuf::new(),
-                stat: unsafe { std::mem::zeroed() },
-            });
-        }
-
         for file in dir.iter() {
             let file = file?;
 
-- 
2.20.1





  parent reply	other threads:[~2020-11-12  9:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-12  9:03 [pbs-devel] [PATCH proxmox-backup 1/3] pxar: fix anchored exclusion at archive root Fabian Ebner
2020-11-12  9:03 ` [pbs-devel] [PATCH proxmox-backup 2/3] pxar: include .pxarexclude files in the archive Fabian Ebner
2020-11-12  9:03 ` Fabian Ebner [this message]
2020-11-12 10:22   ` [pbs-devel] [PATCH proxmox-backup 3/3] pxar: only generate .pxarexclude-cli if there were CLI parameters Wolfgang Bumiller
2020-11-12 10:31 ` [pbs-devel] applied series: [PATCH proxmox-backup 1/3] pxar: fix anchored exclusion at archive root Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112090352.9268-3-f.ebner@proxmox.com \
    --to=f.ebner@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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