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 75BC076F39 for ; Mon, 19 Jul 2021 12:45:01 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 7386E252FB for ; Mon, 19 Jul 2021 12:45:01 +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 id A8D76252F0 for ; Mon, 19 Jul 2021 12:45:00 +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 8249F415DF for ; Mon, 19 Jul 2021 12:45:00 +0200 (CEST) Date: Mon, 19 Jul 2021 12:44:53 +0200 From: Fabian =?iso-8859-1?q?Gr=FCnbichler?= To: Proxmox Backup Server development discussion References: <20210716082834.2354163-1-dietmar@proxmox.com> <20210716082834.2354163-4-dietmar@proxmox.com> In-Reply-To: <<20210716082834.2354163-4-dietmar@proxmox.com> MIME-Version: 1.0 User-Agent: astroid/0.15.0 (https://github.com/astroidmail/astroid) Message-Id: <1626690537.pk0hxcpxj9.astroid@nora.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-SPAM-LEVEL: Spam detection results: 0 AWL 0.486 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% 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 Subject: Re: [pbs-devel] [PATCH proxmox 2/2] open_file_locked: add options parameter (CreateOptions) 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: Mon, 19 Jul 2021 10:45:01 -0000 breaking change, should be marked as such both in the patch as well as=20 with a version bump (or alternatively, be implemented as a new function) requires a patch in proxmox-openid-rs to build also see comments on patch #1 in proxmox-backup! On July 16, 2021 10:28 am, Dietmar Maurer wrote: > To be able to set file permissions and ownership. > --- > proxmox/src/tools/fs.rs | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) >=20 > diff --git a/proxmox/src/tools/fs.rs b/proxmox/src/tools/fs.rs > index 2a93b30..5c269a6 100644 > --- a/proxmox/src/tools/fs.rs > +++ b/proxmox/src/tools/fs.rs > @@ -1,7 +1,7 @@ > //! File related utilities such as `replace_file`. > =20 > use std::ffi::CStr; > -use std::fs::{File, OpenOptions}; > +use std::fs::File; > use std::io::{self, BufRead, BufReader, Write}; > use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; > use std::path::{Path, PathBuf}; > @@ -584,12 +584,17 @@ pub fn open_file_locked>( > path: P, > timeout: Duration, > exclusive: bool, > + options: CreateOptions, > ) -> Result { > let path =3D path.as_ref(); > - let mut file =3D match OpenOptions::new().create(true).append(true).= open(path) { > - Ok(file) =3D> file, > - Err(err) =3D> bail!("Unable to open lock {:?} - {}", path, err), > - }; > + > + let mut file =3D atomic_open_or_create_file( > + path, > + OFlag::O_RDWR | OFlag::O_CLOEXEC | OFlag::O_APPEND, > + &[], > + options, > + )?; > + > match lock_file(&mut file, exclusive, Some(timeout)) { > Ok(_) =3D> Ok(file), > Err(err) =3D> bail!("Unable to acquire lock {:?} - {}", path, er= r), > --=20 > 2.30.2 >=20 >=20 > _______________________________________________ > pbs-devel mailing list > pbs-devel@lists.proxmox.com > https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel >=20 >=20 >=20