[lxc-devel] [lxd/master] tar: Use --xattrs-include=\* during extract
stgraber on Github
lxc-bot at linuxcontainers.org
Thu Aug 2 16:58:21 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 354 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180802/a83ec01c/attachment.bin>
-------------- next part --------------
From 38778dfb6fbda86ddf2ec273968364e7d9d55bd7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Thu, 2 Aug 2018 12:57:37 -0400
Subject: [PATCH] tar: Use --xattrs-include=\* during extract
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage_btrfs.go | 4 ++--
lxd/storage_ceph.go | 4 ++--
lxd/storage_dir.go | 4 ++--
lxd/storage_lvm.go | 4 ++--
lxd/storage_zfs.go | 4 ++--
shared/archive_linux.go | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index 898568c2df..868457b23c 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -1880,7 +1880,7 @@ func (s *storageBtrfs) doContainerBackupLoadVanilla(info backupInfo, data io.Rea
cur := fmt.Sprintf("backup/snapshots/%s", snap)
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--recursive-unlink", "--xattrs", "--strip-components=3", "-C", containerMntPoint, cur)
+ "--recursive-unlink", "--xattrs-include=*", "--strip-components=3", "-C", containerMntPoint, cur)
if err != nil {
logger.Errorf("Failed to untar \"%s\" into \"%s\": %s", cur, containerMntPoint, err)
return err
@@ -1896,7 +1896,7 @@ func (s *storageBtrfs) doContainerBackupLoadVanilla(info backupInfo, data io.Rea
// Extract container
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--strip-components=2", "--xattrs", "-C", containerMntPoint, "backup/container")
+ "--strip-components=2", "--xattrs-include=*", "-C", containerMntPoint, "backup/container")
if err != nil {
logger.Errorf("Failed to untar \"backup/container\" into \"%s\": %s", containerMntPoint, err)
return err
diff --git a/lxd/storage_ceph.go b/lxd/storage_ceph.go
index b782dfe7a5..475eb2149b 100644
--- a/lxd/storage_ceph.go
+++ b/lxd/storage_ceph.go
@@ -2001,7 +2001,7 @@ func (s *storageCeph) ContainerBackupLoad(info backupInfo, data io.ReadSeeker) e
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--recursive-unlink", "--strip-components=3", "--xattrs", "-C", containerMntPoint, cur)
+ "--recursive-unlink", "--strip-components=3", "--xattrs-include=*", "-C", containerMntPoint, cur)
if err != nil {
logger.Errorf("Failed to untar \"%s\" into \"%s\": %s", cur, containerMntPoint, err)
return err
@@ -2030,7 +2030,7 @@ func (s *storageCeph) ContainerBackupLoad(info backupInfo, data io.ReadSeeker) e
// Extract container
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--strip-components=2", "--xattrs", "-C", containerMntPoint, "backup/container")
+ "--strip-components=2", "--xattrs-include=*", "-C", containerMntPoint, "backup/container")
if err != nil {
logger.Errorf("Failed to untar \"backup/container\" into \"%s\": %s", containerMntPoint, err)
return err
diff --git a/lxd/storage_dir.go b/lxd/storage_dir.go
index 76f39fa631..aa4025073d 100644
--- a/lxd/storage_dir.go
+++ b/lxd/storage_dir.go
@@ -1278,7 +1278,7 @@ func (s *storageDir) ContainerBackupLoad(info backupInfo, data io.ReadSeeker) er
// Extract container
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf",
- "-", "--strip-components=2", "--xattrs", "-C", containerMntPoint, "backup/container")
+ "-", "--strip-components=2", "--xattrs-include=*", "-C", containerMntPoint, "backup/container")
if err != nil {
return err
}
@@ -1298,7 +1298,7 @@ func (s *storageDir) ContainerBackupLoad(info backupInfo, data io.ReadSeeker) er
// Extract snapshots
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--strip-components=2", "--xattrs", "-C", snapshotMntPoint, "backup/snapshots")
+ "--strip-components=2", "--xattrs-include=*", "-C", snapshotMntPoint, "backup/snapshots")
if err != nil {
return err
}
diff --git a/lxd/storage_lvm.go b/lxd/storage_lvm.go
index ef583e5588..a2342dbe8d 100644
--- a/lxd/storage_lvm.go
+++ b/lxd/storage_lvm.go
@@ -1854,7 +1854,7 @@ func (s *storageLvm) ContainerBackupLoad(info backupInfo, data io.ReadSeeker) er
// Extract container
data.Seek(0, 0)
- err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-", "--strip-components=2", "--xattrs",
+ err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-", "--strip-components=2", "--xattrs-include=*",
"-C", containerPath, "backup/container")
if err != nil {
return err
@@ -1870,7 +1870,7 @@ func (s *storageLvm) ContainerBackupLoad(info backupInfo, data io.ReadSeeker) er
// Extract snapshots
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--strip-components=3", "--xattrs", "-C", containerPath, fmt.Sprintf("backup/snapshots/%s", snap))
+ "--strip-components=3", "--xattrs-include=*", "-C", containerPath, fmt.Sprintf("backup/snapshots/%s", snap))
if err != nil {
return err
}
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 0adc57a6d7..33b11f6a9c 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -2227,7 +2227,7 @@ func (s *storageZfs) doContainerBackupLoadVanilla(info backupInfo, data io.ReadS
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--recursive-unlink", "--strip-components=3", "--xattrs", "-C", containerMntPoint, cur)
+ "--recursive-unlink", "--strip-components=3", "--xattrs-include=*", "-C", containerMntPoint, cur)
if err != nil {
logger.Errorf("Failed to untar \"%s\" into \"%s\": %s", cur, containerMntPoint, err)
return err
@@ -2243,7 +2243,7 @@ func (s *storageZfs) doContainerBackupLoadVanilla(info backupInfo, data io.ReadS
// Extract container
data.Seek(0, 0)
err = shared.RunCommandWithFds(data, nil, "tar", "-xJf", "-",
- "--strip-components=2", "--xattrs", "-C", containerMntPoint, "backup/container")
+ "--strip-components=2", "--xattrs-include=*", "-C", containerMntPoint, "backup/container")
if err != nil {
logger.Errorf("Failed to untar \"backup/container\" into \"%s\": %s", containerMntPoint, err)
return err
diff --git a/shared/archive_linux.go b/shared/archive_linux.go
index 37f27ab760..bc3ebe00af 100644
--- a/shared/archive_linux.go
+++ b/shared/archive_linux.go
@@ -67,7 +67,7 @@ func Unpack(file string, path string, blockBackend bool, runningInUserns bool) e
args = append(args, "--exclude=rootfs/dev/*")
args = append(args, "--exclude=rootfs/./dev/*")
}
- args = append(args, "-C", path, "--numeric-owner", "--xattrs")
+ args = append(args, "-C", path, "--numeric-owner", "--xattrs-include=*")
args = append(args, extractArgs...)
args = append(args, file)
} else if strings.HasPrefix(extension, ".squashfs") {
More information about the lxc-devel
mailing list