[lxc-devel] [lxd/master] lxd/backup: Have tar not transform symlink targets

monstermunchkin on Github lxc-bot at linuxcontainers.org
Mon Feb 24 09:57:51 UTC 2020


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 474 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20200224/fe22a847/attachment.bin>
-------------- next part --------------
From 41c60eb27ca5f3cff5ef34f87490bcfd606d799f Mon Sep 17 00:00:00 2001
From: Thomas Hipp <thomas.hipp at canonical.com>
Date: Mon, 24 Feb 2020 10:57:17 +0100
Subject: [PATCH] lxd/backup: Have tar not transform symlink targets

This adds the 'S' flag to tar's transformation. It tells tar to not
apply transformation to symbolic link targets.

Signed-off-by: Thomas Hipp <thomas.hipp at canonical.com>
---
 lxd/backup.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lxd/backup.go b/lxd/backup.go
index 64c5e5b022..38d7077ed3 100644
--- a/lxd/backup.go
+++ b/lxd/backup.go
@@ -181,7 +181,7 @@ func backupCreateTarball(s *state.State, path string, b backup.Backup, c instanc
 		os.RemoveAll(backupPath)
 	}()
 
-	args := []string{"-cf", backupPath, "--numeric-owner", "--xattrs", "-C", path, "--transform", "s,^./,backup/,", "."}
+	args := []string{"-cf", backupPath, "--numeric-owner", "--xattrs", "-C", path, "--transform", "s,^./,backup/,S", "."}
 	_, err = shared.RunCommand("tar", args...)
 	if err != nil {
 		return err


More information about the lxc-devel mailing list