[PATCH] meson: src: Fix DESTDIR handling while creating dirs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Jan Kiszka <jan.kiszka@xxxxxxxxxxx>

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@xxxxxxxxxxx>
---
 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





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux