about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/build-bazel-package/default.nix1
-rw-r--r--pkgs/build-support/rust/default.nix3
-rw-r--r--pkgs/build-support/setup-hooks/auto-patchelf.sh11
3 files changed, 10 insertions, 5 deletions
diff --git a/pkgs/build-support/build-bazel-package/default.nix b/pkgs/build-support/build-bazel-package/default.nix
index f39f4e65e454..b0840192ecec 100644
--- a/pkgs/build-support/build-bazel-package/default.nix
+++ b/pkgs/build-support/build-bazel-package/default.nix
@@ -50,6 +50,7 @@ in stdenv.mkDerivation (fBuildAttrs // {
 
       # Patching markers to make them deterministic
       sed -i 's, -\?[0-9][0-9]*$, 1,' $bazelOut/external/\@*.marker
+      sed -i '/^ENV:TMP.*/d' $bazelOut/external/\@*.marker
 
       # Remove all vcs files
       rm -rf $(find $bazelOut/external -type d -name .git)
diff --git a/pkgs/build-support/rust/default.nix b/pkgs/build-support/rust/default.nix
index 43aecdef5f2e..c69832a89b9f 100644
--- a/pkgs/build-support/rust/default.nix
+++ b/pkgs/build-support/rust/default.nix
@@ -1,6 +1,7 @@
 { stdenv, cacert, git, cargo, rustc, cargo-vendor, fetchcargo, python3 }:
 
-{ name, cargoSha256 ? "unset"
+{ name ? "${args.pname}-${args.version}"
+, cargoSha256 ? "unset"
 , src ? null
 , srcs ? null
 , cargoPatches ? []
diff --git a/pkgs/build-support/setup-hooks/auto-patchelf.sh b/pkgs/build-support/setup-hooks/auto-patchelf.sh
index 5bedd1a9f9ca..6af8eb1aed99 100644
--- a/pkgs/build-support/setup-hooks/auto-patchelf.sh
+++ b/pkgs/build-support/setup-hooks/auto-patchelf.sh
@@ -15,8 +15,10 @@ isExecutable() {
     # *or* there is an INTERP section. This also catches position-independent
     # executables, as they typically have an INTERP section but their ELF type
     # is DYN.
-    LANG=C readelf -h -l "$1" 2> /dev/null \
-        | grep -q '^ *Type: *EXEC\>\|^ *INTERP\>'
+    isExeResult="$(LANG=C readelf -h -l "$1" 2> /dev/null \
+        | grep '^ *Type: *EXEC\>\|^ *INTERP\>')"
+    # not using grep -q, because it can cause Broken pipe
+    [ -n "$isExeResult" ]
 }
 
 # We cache dependencies so that we don't need to search through all of them on
@@ -207,10 +209,11 @@ autoPatchelf() {
       isELF "$file" || continue
       segmentHeaders="$(LANG=C readelf -l "$file")"
       # Skip if the ELF file doesn't have segment headers (eg. object files).
-      echo "$segmentHeaders" | grep -q '^Program Headers:' || continue
+      # not using grep -q, because it can cause Broken pipe
+      [ -n "$(echo "$segmentHeaders" | grep '^Program Headers:')" ] || continue
       if isExecutable "$file"; then
           # Skip if the executable is statically linked.
-          echo "$segmentHeaders" | grep -q "^ *INTERP\\>" || continue
+          [ -n "$(echo "$segmentHeaders" | grep "^ *INTERP\\>")" ] || continue
       fi
       autoPatchelfFile "$file"
     done < <(find "$@" ${norecurse:+-maxdepth 1} -type f -print0)