public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Filip Schauer <f.schauer@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH backup 1/1] fix #4995: pxar: Include symlinks in zip file restore
Date: Mon, 20 Nov 2023 12:54:31 +0100	[thread overview]
Message-ID: <20231120115431.59012-3-f.schauer@proxmox.com> (raw)
In-Reply-To: <20231120115431.59012-1-f.schauer@proxmox.com>

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
 pbs-client/src/pxar/extract.rs | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
index f78e06c2..6f23c144 100644
--- a/pbs-client/src/pxar/extract.rs
+++ b/pbs-client/src/pxar/extract.rs
@@ -998,6 +998,7 @@ where
                 metadata.stat.mtime.secs,
                 metadata.stat.mode as u16,
                 false,
+                None,
             );
             zip.add_entry::<FileContents<T>>(entry, None).await?;
         }
@@ -1017,6 +1018,7 @@ where
                         metadata.stat.mtime.secs,
                         metadata.stat.mode as u16,
                         true,
+                        None,
                     );
                     zip.add_entry(entry, decoder.contents())
                         .await
@@ -1035,6 +1037,7 @@ where
                         metadata.stat.mtime.secs,
                         metadata.stat.mode as u16,
                         true,
+                        None,
                     );
                     zip.add_entry(entry, decoder.contents())
                         .await
@@ -1047,9 +1050,24 @@ where
                         metadata.stat.mtime.secs,
                         metadata.stat.mode as u16,
                         false,
+                        None,
                     );
                     zip.add_entry::<FileContents<T>>(entry, None).await?;
                 }
+                EntryKind::Symlink(link) => {
+                    log::debug!("adding '{}' to zip", path.display());
+                    let realpath = Path::new(link);
+
+                    let entry = ZipEntry::new(
+                        path,
+                        metadata.stat.mtime.secs,
+                        metadata.stat.mode as u16,
+                        true,
+                        Some(realpath),
+                    );
+
+                    zip.add_entry::<FileContents<T>>(entry, None).await?;
+                }
                 _ => {} // ignore all else
             };
         }
-- 
2.39.2





  parent reply	other threads:[~2023-11-20 11:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-20 11:54 [pve-devel] [PATCH many] fix #4995: " Filip Schauer
2023-11-20 11:54 ` [pve-devel] [PATCH proxmox 1/1] fix #4995: compression: " Filip Schauer
2023-11-20 11:54 ` Filip Schauer [this message]
2023-11-20 11:57 ` [pve-devel] [PATCH many] fix #4995: " Filip Schauer

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=20231120115431.59012-3-f.schauer@proxmox.com \
    --to=f.schauer@proxmox.com \
    --cc=pve-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
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal