From: Jan Kiszka <jan.kiszka(a)siemens.com>
If the target path contains a link with an absolute path (e.g.
/var/run -> /run), makedirs will target the wrong location. Resolve the
path first, then append DESTDIR again if needed.
Signed-off-by: Jan Kiszka <jan.kiszka(a)siemens.com>
---
scripts/meson-install-dirs.py | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/scripts/meson-install-dirs.py b/scripts/meson-install-dirs.py
index 14ec6b93e8..e762e44712 100644
--- a/scripts/meson-install-dirs.py
+++ b/scripts/meson-install-dirs.py
@@ -6,4 +6,7 @@ import sys
destdir = os.environ.get('DESTDIR', os.sep)
for dirname in sys.argv[1:]:
- os.makedirs(os.path.join(destdir, dirname.strip(os.sep)), exist_ok=True)
+ realdir = os.path.realpath(os.path.join(destdir, dirname.strip(os.sep)))
+ if not realdir.startswith(destdir):
+ realdir = os.path.join(destdir, realdir.strip(os.sep))
+ os.makedirs(realdir, exist_ok=True)
--
2.26.2