about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2020-08-12 18:44:25 +0200
committerFlorian Klink <flokli@flokli.de>2020-08-12 18:44:25 +0200
commit0c46d8f140d817c11edb1983fd6d5d929e365c21 (patch)
tree7c8af1dc02709d920527fc778c48a2261b05be2f /pkgs
parent04ee34c52e338a87fb66e339d64cb6a15111194f (diff)
parente8bfa708c474c276d66318441e648a9c50e0f389 (diff)
Merge remote-tracking branch 'origin/staging-next' into master
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/tools/build-managers/meson/clear-old-rpath.patch20
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix8
2 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch b/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch
new file mode 100644
index 0000000000000..0a52fe60e9dcd
--- /dev/null
+++ b/pkgs/development/tools/build-managers/meson/clear-old-rpath.patch
@@ -0,0 +1,20 @@
+diff --git a/mesonbuild/scripts/depfixer.py b/mesonbuild/scripts/depfixer.py
+index 77ac03d66..d12f77592 100644
+--- a/mesonbuild/scripts/depfixer.py
++++ b/mesonbuild/scripts/depfixer.py
+@@ -337,6 +337,15 @@ class Elf(DataSizes):
+         if not new_rpath:
+             self.remove_rpath_entry(entrynum)
+         else:
++            # Clear old rpath to avoid stale references,
++            # not heeding the warning above about de-duplication
++            # since it does not seem to cause issues for us
++            # and not doing so trips up Nix’s reference checker.
++            # See https://github.com/NixOS/nixpkgs/pull/46020
++            # and https://github.com/NixOS/nixpkgs/issues/95163
++            self.bf.seek(rp_off)
++            self.bf.write(b'\0'*len(old_rpath))
++
+             self.bf.seek(rp_off)
+             self.bf.write(new_rpath)
+             self.bf.write(b'\0')
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index dad1dfa360c59..c32635d80e1e7 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -43,6 +43,14 @@ python3.pkgs.buildPythonApplication rec {
       src = ./fix-rpath.patch;
       inherit (builtins) storeDir;
     })
+
+    # When Meson removes build_rpath from DT_RUNPATH entry, it just writes
+    # the shorter NUL-terminated new rpath over the old one to reduce
+    # the risk of potentially breaking the ELF files.
+    # But this can cause much bigger problem for Nix as it can produce
+    # cut-in-half-by-\0 store path references.
+    # Let’s just clear the whole rpath and hope for the best.
+    ./clear-old-rpath.patch
   ];
 
   setupHook = ./setup-hook.sh;