From 55ed1201a9bcde4eb0800e4e9ba6a4daede6f1a8 Mon Sep 17 00:00:00 2001 From: Tony Aiuto Date: Wed, 15 Nov 2023 15:58:15 -0500 Subject: [PATCH] pkg_tar: if symlink starts with ./, keep it absolute For the `symlink` attribute of `pkg_tar`, if the path begins with ./, preserve the path rather than prefixing package_dir. This allows graceful migration for some uses who rely on the previous package_dir behavior. --- pkg/private/tar/build_tar.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/private/tar/build_tar.py b/pkg/private/tar/build_tar.py index 81ad03fe..559c02e3 100644 --- a/pkg/private/tar/build_tar.py +++ b/pkg/private/tar/build_tar.py @@ -184,7 +184,10 @@ def add_link(self, symlink, destination, mode=None, ids=None, names=None): names: (username, groupname) for the file to set ownership. An empty file will be created as `destfile` in the layer. """ - dest = self.normalize_path(symlink) + if not symlink.startswith("./"): + dest = self.normalize_path(symlink) + else: + dest = symlink self.tarfile.add_file( dest, tarfile.SYMTYPE,