diff options
author | Alyssa Ross <hi@alyssa.is> | 2019-04-14 17:50:16 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2019-04-14 17:50:16 +0000 |
commit | 439ebf093f2779d73bc76484a36be2889cc807bf (patch) | |
tree | 7dd3b84fb345c228165c2dae6c7cdd54b433db9e /nixpkgs/pkgs/build-support/setup-hooks | |
parent | d7417c2c1096b13fe903af802c7cf019fca14a7b (diff) | |
parent | 0c0954781e257b8b0dc49341795a2fe7d96945a3 (diff) | |
download | nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.tar nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.tar.gz nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.tar.bz2 nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.tar.lz nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.tar.xz nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.tar.zst nixlib-439ebf093f2779d73bc76484a36be2889cc807bf.zip |
Merge commit '0c0954781e257b8b0dc49341795a2fe7d96945a3'
Diffstat (limited to 'nixpkgs/pkgs/build-support/setup-hooks')
-rw-r--r-- | nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh b/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh index 5bedd1a9f9ca..6af8eb1aed99 100644 --- a/nixpkgs/pkgs/build-support/setup-hooks/auto-patchelf.sh +++ b/nixpkgs/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) |