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 6FFAD69147 for ; Thu, 12 Nov 2020 12:38:42 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 5F3E6EF63 for ; Thu, 12 Nov 2020 12:38:12 +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) server-digest SHA256) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id AA232EF5B for ; Thu, 12 Nov 2020 12:38:11 +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 6FA3D4215F for ; Thu, 12 Nov 2020 12:38:11 +0100 (CET) From: Fabian Ebner To: pbs-devel@lists.proxmox.com Cc: Wolfgang Bumiller Date: Thu, 12 Nov 2020 12:38:06 +0100 Message-Id: <20201112113806.8083-1-f.ebner@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.036 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 T_SPF_HELO_TEMPERROR 0.01 SPF: test of HELO record failed (temperror) T_SPF_TEMPERROR 0.01 SPF: test of record failed (temperror) URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [proxmox.com] Subject: [pbs-devel] [PATCH proxmox-backup] pxar: avoid including archive root's exclude patterns in .pxarexclude-cli 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 11:38:42 -0000 The patterns from the archive root's .pxarexclude file are already present in self.patterns when encode_pxarexclude_cli is called. Pass along the number of CLI patterns and slice accordingly. Suggested-By: Wolfgang Bumiller Signed-off-by: Fabian Ebner --- Follow-up for: https://lists.proxmox.com/pipermail/pbs-devel/2020-November/001509.html src/pxar/create.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pxar/create.rs b/src/pxar/create.rs index c907a8e0..cc28a79d 100644 --- a/src/pxar/create.rs +++ b/src/pxar/create.rs @@ -255,7 +255,7 @@ impl<'a, 'b> Archiver<'a, 'b> { let file_name = file_entry.name.to_bytes(); if is_root && file_name == b".pxarexclude-cli" { - self.encode_pxarexclude_cli(encoder, &file_entry.name)?; + self.encode_pxarexclude_cli(encoder, &file_entry.name, old_patterns_count)?; continue; } @@ -387,8 +387,9 @@ impl<'a, 'b> Archiver<'a, 'b> { &mut self, encoder: &mut Encoder, file_name: &CStr, + patterns_count: usize, ) -> Result<(), Error> { - let content = generate_pxar_excludes_cli(&self.patterns); + let content = generate_pxar_excludes_cli(&self.patterns[..patterns_count]); if let Some(ref mut catalog) = self.catalog { catalog.add_file(file_name, content.len() as u64, 0)?; -- 2.20.1