dockerTools: Fix streamLayeredImage for symlinks

When archiving `/nix/store/foo` and `foo` is itself a symlink, we must
not traverse the symlink target, but archive the `foo` symlink itself
This commit is contained in:
Sarah Brofeldt 2021-01-04 19:39:21 +01:00
parent 56bb1b0f7a
commit 08b0d02944

View file

@ -83,7 +83,11 @@ def archive_paths_to(obj, paths, mtime):
for path in paths:
path = pathlib.Path(path)
files = itertools.chain([path], path.rglob("*"))
if path.is_symlink():
files = [path]
else:
files = itertools.chain([path], path.rglob("*"))
for filename in sorted(files):
ti = append_root(tar.gettarinfo(filename))