[virt-tools-list] [virt-bootstrap] [PATCH 5/5] docker-source: Preserve extended file attributes

Radostin Stoyanov rstoyanov1 at gmail.com
Tue Apr 10 16:38:05 UTC 2018


Preserve extended file attributes of extracted rootfs as described in
https://github.com/opencontainers/image-spec/blob/master/layer.md

Signed-off-by: Radostin Stoyanov <rstoyanov1 at gmail.com>
---
 src/virtBootstrap/utils.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/virtBootstrap/utils.py b/src/virtBootstrap/utils.py
index ec6a96e..94b3ccb 100644
--- a/src/virtBootstrap/utils.py
+++ b/src/virtBootstrap/utils.py
@@ -278,8 +278,12 @@ def safe_untar(src, dest):
     # Note: Here we use --absolute-names flag to get around the error message
     # "Cannot open: Permission denied" when symlynks are extracted, with the
     # qemu:/// driver. This flag must not be used outside virt-sandbox.
+    #
+    # Preserve file attributes following the specification in
+    # https://github.com/opencontainers/image-spec/blob/master/layer.md
     params = ['--', '/bin/tar', 'xf', src, '-C', '/mnt', '--exclude', 'dev/*',
-              '--overwrite', '--absolute-names']
+              '--overwrite', '--absolute-names',
+              '--acls', '--xattrs', '--selinux']
     execute(virt_sandbox + params)
 
 
-- 
2.14.3




More information about the virt-tools-list mailing list