diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-09-06 10:21:43 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-09-06 10:26:30 +0200 |
commit | 8f33b8cc93006c97a8f6b7ede20214992ed31fa8 (patch) | |
tree | 319163313cd55a160bbd9376151da1c96e124fd2 /pkgs/build-support | |
parent | f67ddbaa6f049cdd2a5e2333e3679c4f5f4b638f (diff) | |
download | nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.tar nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.tar.gz nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.tar.bz2 nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.tar.lz nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.tar.xz nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.tar.zst nixlib-8f33b8cc93006c97a8f6b7ede20214992ed31fa8.zip |
mass rewrite of find parameters to cross-platform style
Fixes #9044, close #9667. Thanks to @taku0 for suggesting this solution. Now we have no modes starting with `/` or `+`. Rewrite the `-perm` parameters of find: - completely safe: rewrite `/0100` and `+100` to `-0100`, - slightly semantics-changing: rewrite `+111` to `-0100`. I cross-verified the `find` manual pages for Linux, Darwin, FreeBSD.
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/builder-defs/builder-defs.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/setup-hooks/patch-shebangs.sh | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/pkgs/build-support/builder-defs/builder-defs.nix b/pkgs/build-support/builder-defs/builder-defs.nix index e7c64501614c..6ea4ec86c480 100644 --- a/pkgs/build-support/builder-defs/builder-defs.nix +++ b/pkgs/build-support/builder-defs/builder-defs.nix @@ -569,7 +569,7 @@ let inherit (builtins) head tail trace; in # Interpreters that are already in the store are left untouched. echo "patching script interpreter paths" local f - for f in $(find "${dir}" -xtype f -perm /0100); do + for f in $(find "${dir}" -xtype f -perm -0100); do local oldPath=$(sed -ne '1 s,^#![ ]*\([^ ]*\).*$,\1,p' "$f") if test -n "$oldPath" -a "''${oldPath:0:''${#NIX_STORE}}" != "$NIX_STORE"; then local newPath=$(type -P $(basename $oldPath) || true) diff --git a/pkgs/build-support/setup-hooks/patch-shebangs.sh b/pkgs/build-support/setup-hooks/patch-shebangs.sh index 44ebad0d593b..152755992f68 100644 --- a/pkgs/build-support/setup-hooks/patch-shebangs.sh +++ b/pkgs/build-support/setup-hooks/patch-shebangs.sh @@ -18,7 +18,7 @@ patchShebangs() { local oldInterpreterLine local newInterpreterLine - find "$dir" -type f -perm /0100 | while read f; do + find "$dir" -type f -perm -0100 | while read f; do if [ "$(head -1 "$f" | head -c +2)" != '#!' ]; then # missing shebang => not a script continue |