From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 52D97690E6 for ; Thu, 12 Nov 2020 11:23:23 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 3FF84D391 for ; Thu, 12 Nov 2020 11:22:53 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id BCB03D387 for ; Thu, 12 Nov 2020 11:22:52 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 80E3C42155 for ; Thu, 12 Nov 2020 11:22:52 +0100 (CET) Date: Thu, 12 Nov 2020 11:22:51 +0100 From: Wolfgang Bumiller To: Fabian Ebner Cc: pbs-devel@lists.proxmox.com Message-ID: <20201112102251.p3qtmqknyjifcw6j@olga.proxmox.com> References: <20201112090352.9268-1-f.ebner@proxmox.com> <20201112090352.9268-3-f.ebner@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201112090352.9268-3-f.ebner@proxmox.com> User-Agent: NeoMutt/20180716 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.009 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [create.rs] Subject: Re: [pbs-devel] [PATCH proxmox-backup 3/3] pxar: only generate .pxarexclude-cli if there were CLI parameters X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Nov 2020 10:23:23 -0000 series looks good to me, one thing though below: On Thu, Nov 12, 2020 at 10:03:52AM +0100, Fabian Ebner wrote: > 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 > --- > 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(); Doesn't a similar issue still happen in encode_pxarexcludes_cli() since we call it later below with `self.patterns` already extended by the current `.pxarexclude` file? May have to pass `old_patterns_count` along to it? > 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