From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: Proxmox Backup Server development discussion
<pbs-devel@lists.proxmox.com>
Subject: [pbs-devel] applied: [PATCH backup v3 3/3] pxar: extract: Follow overwrite_flags when opening file
Date: Mon, 27 Jan 2025 13:27:38 +0100 [thread overview]
Message-ID: <1737980632.gpzckicfhf.astroid@yuna.none> (raw)
In-Reply-To: <20250127121016.247973-3-m.sandoval@proxmox.com>
On January 27, 2025 1:10 pm, Maximiliano Sandoval wrote:
> Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
> ---
> pbs-client/src/pxar/extract.rs | 15 ++++++++++++---
> 1 file changed, 12 insertions(+), 3 deletions(-)
>
> diff --git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
> index 64754006..6b0e6302 100644
> --- a/pbs-client/src/pxar/extract.rs
> +++ b/pbs-client/src/pxar/extract.rs
> @@ -133,9 +133,18 @@ where
>
> if let Some(ref path) = options.prelude_path {
> if let Some(entry) = prelude {
> - let mut prelude_file = OpenOptions::new()
> - .create(true)
> - .write(true)
> + let overwrite = options.overwrite_flags.contains(OverwriteFlags::FILE);
> +
> + let mut open_options = OpenOptions::new();
> + open_options.write(true);
> + if overwrite {
> + open_options.create(true);
> + open_options.truncate(true);
> + } else {
> + open_options.create_new(true);
> + }
> +
> + let mut prelude_file = open_options
> .open(path)
> .with_context(|| format!("error creating prelude file '{path:?}'"))?;
> if let pxar::EntryKind::Prelude(ref prelude) = entry.kind() {
> --
> 2.39.5
>
>
>
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
>
>
>
_______________________________________________
pbs-devel mailing list
pbs-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
next prev parent reply other threads:[~2025-01-27 12:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 12:10 [pbs-devel] [PATCH backup v3 1/3] use truncate whenever we create files Maximiliano Sandoval
2025-01-27 12:10 ` [pbs-devel] [PATCH backup v3 2/3] remove create & truncate when create_new is used Maximiliano Sandoval
2025-01-27 12:27 ` Fabian Grünbichler
2025-01-27 12:37 ` Maximiliano Sandoval
2025-01-27 12:10 ` [pbs-devel] [PATCH backup v3 3/3] pxar: extract: Follow overwrite_flags when opening file Maximiliano Sandoval
2025-01-27 12:27 ` Fabian Grünbichler [this message]
2025-01-27 12:27 ` [pbs-devel] applied: [PATCH backup v3 1/3] use truncate whenever we create files Fabian Grünbichler
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=1737980632.gpzckicfhf.astroid@yuna.none \
--to=f.gruenbichler@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