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

Filip Schauer f.schauer at proxmox.com
Wed Jan 24 11:15:19 CET 2024


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 | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/pbs-client/src/pxar/extract.rs b/pbs-client/src/pxar/extract.rs
index a7f94bf6..96053e42 100644
--- a/pbs-client/src/pxar/extract.rs
+++ b/pbs-client/src/pxar/extract.rs
@@ -1052,6 +1052,17 @@ where
                     )
                     .await?;
                 }
+                EntryKind::Symlink(link) => {
+                    log::debug!("adding '{}' to zip", path.display());
+                    let realpath = Path::new(link);
+                    zip.add_entry(
+                        path,
+                        metadata.stat.mtime.secs,
+                        metadata.stat.mode as u16,
+                        FileType::<FileContents<T>>::Symlink(realpath.into()),
+                    )
+                    .await?;
+                }
                 _ => {} // ignore all else
             };
         }
-- 
2.39.2





More information about the pbs-devel mailing list