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
commit08b0d02944eb94359726ac61af3c3ab84b53ee7d
authorSarah Brofeldt <sarah@qtr.dk>
dateMon 4 Jan 2021, 19:39 (6 years ago)
parent56bb1b0
pkgs/build-support/docker/stream_layered_image.py+5−1
@@ -83,7 +83,11 @@ def archive_paths_to(obj, paths, mtime):
8383
8484 for path in paths:
8585 path = pathlib.Path(path)
86− files = itertools.chain([path], path.rglob("*"))
86+ if path.is_symlink():
87+ files = [path]
88+ else:
89+ files = itertools.chain([path], path.rglob("*"))
90+
8791 for filename in sorted(files):
8892 ti = append_root(tar.gettarinfo(filename))
8993