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 4012A99C8 for ; Fri, 4 Aug 2023 09:59:58 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1A8C7B77D for ; Fri, 4 Aug 2023 09:59:28 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (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 for ; Fri, 4 Aug 2023 09:59:27 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 2143F42B88 for ; Fri, 4 Aug 2023 09:59:27 +0200 (CEST) Date: Fri, 04 Aug 2023 09:59:21 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20230803152238.124625-1-g.goller@proxmox.com> In-Reply-To: <20230803152238.124625-1-g.goller@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.16.0 (https://github.com/astroidmail/astroid) Message-Id: <1691135264.qvg52bo6b9.astroid@yuna.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.069 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - 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, proxmox.com] Subject: [pbs-devel] applied: [PATH proxmox-backup] fix #4380: stat() is run when file is executed 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: Fri, 04 Aug 2023 07:59:58 -0000 although a somewhat rare edge case, this does improve things a bit! there is still a stray failed to open file: ".pxarexclude": access denied if the client encounters a dir with +r, but -x, even if all of the dirs entries are excluded.. I guess we could actually skip iterating with a more meaningful error message if we lack -x? or just check that all dir entries (which we get thanks to +r) of that dir are excluded by the patterns we already have at that point, instead of attempting to read the contained patterns and then recursively iterate over the dir's entries? On August 3, 2023 5:22 pm, Gabriel Goller wrote: > When executing `proxmox-backup-client backup ... > --exclude "test/test.txt"` it still executed stat() on "test.txt", > which won't work when the current user doesn't have access to the > file or the parent folder. Now we check if the file is excluded, > and if it is not, then we execute stat(). >=20 > Signed-off-by: Gabriel Goller > --- > pbs-client/src/pxar/create.rs | 18 +++++++++--------- > 1 file changed, 9 insertions(+), 9 deletions(-) >=20 > diff --git a/pbs-client/src/pxar/create.rs b/pbs-client/src/pxar/create.r= s > index 2577cf98..c573c2a3 100644 > --- a/pbs-client/src/pxar/create.rs > +++ b/pbs-client/src/pxar/create.rs > @@ -434,6 +434,15 @@ impl Archiver { > assert_single_path_component(os_file_name)?; > let full_path =3D self.path.join(os_file_name); > =20 > + let match_path =3D PathBuf::from("/").join(full_path.clone()= ); > + if self > + .patterns > + .matches(match_path.as_os_str().as_bytes(), None) > + =3D=3D Some(MatchType::Exclude) > + { > + continue; > + } > + > let stat =3D match nix::sys::stat::fstatat( > dir_fd, > file_name.as_c_str(), > @@ -444,15 +453,6 @@ impl Archiver { > Err(err) =3D> return Err(err).context(format!("stat fail= ed on {:?}", full_path)), > }; > =20 > - let match_path =3D PathBuf::from("/").join(full_path.clone()= ); > - if self > - .patterns > - .matches(match_path.as_os_str().as_bytes(), Some(stat.st= _mode)) > - =3D=3D Some(MatchType::Exclude) > - { > - continue; > - } > - > self.entry_counter +=3D 1; > if self.entry_counter > self.entry_limit { > bail!( > --=20 > 2.39.2 >=20 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20