[pbs-devel] [PATCH v3 backup 2/2] fix #4995: pxar: Include symlinks in zip file creation

Filip Schauer f.schauer at proxmox.com
Thu Dec 14 15:48:24 CET 2023


Include symlinks when restoring a backup as a zip file.

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

diff --git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
index d8bbd3e1..b10609e0 100644
--- a/pbs-client/src/pxar/extract.rs
+++ b/pbs-client/src/pxar/extract.rs
@@ -1050,6 +1050,19 @@ where
                     );
                     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,
+                        FileType::Symlink(realpath.into()),
+                    );
+
+                    zip.add_entry::<FileContents<T>>(entry, None).await?;
+                }
                 _ => {} // ignore all else
             };
         }
-- 
2.39.2





More information about the pbs-devel mailing list