From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 2/2] pbs-client: extract: add top-level dir in tar.zst
Date: Tue, 19 Apr 2022 12:28:28 +0200 [thread overview]
Message-ID: <20220419102828.2847367-2-d.csapak@proxmox.com> (raw)
In-Reply-To: <20220419102828.2847367-1-d.csapak@proxmox.com>
when download a folder, include that folder as first entry (except '/')
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
| 16 ++++++++++++++++
1 file changed, 16 insertions(+)
--git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
index 90ce88bd..f18fc7d4 100644
--- a/pbs-client/src/pxar/extract.rs
+++ b/pbs-client/src/pxar/extract.rs
@@ -557,6 +557,22 @@ where
let mut hardlinks: HashMap<PathBuf, PathBuf> = HashMap::new();
if let Ok(dir) = file.enter_directory().await {
+ let entry = dir.lookup_self().await?;
+ let path = entry.path().strip_prefix(prefix)?;
+
+ if path != Path::new("/") {
+ let metadata = entry.metadata();
+ let mut header = tar::Header::new_gnu();
+ header.set_entry_type(tar::EntryType::Directory);
+ add_metadata_to_header(&mut header, metadata);
+ header.set_size(0);
+ header.set_cksum();
+ tarencoder
+ .add_entry(&mut header, path, tokio::io::empty())
+ .await
+ .map_err(|err| format_err!("could not send dir entry: {}", err))?;
+ }
+
let mut decoder = dir.decode_full().await?;
decoder.enable_goodbye_entries(false);
while let Some(entry) = decoder.next().await {
--
2.30.2
next prev parent reply other threads:[~2022-04-19 10:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-19 10:28 [pbs-devel] [PATCH proxmox-backup 1/2] pbs-client: extract: rewrite create_zip with sequential decoder Dominik Csapak
2022-04-19 10:28 ` Dominik Csapak [this message]
2022-04-22 9:43 ` [pbs-devel] applied: " Wolfgang Bumiller
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=20220419102828.2847367-2-d.csapak@proxmox.com \
--to=d.csapak@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal