From 40990bb864954f33ee1f37db60d1ca8f185bd66b Mon Sep 17 00:00:00 2001 From: Igor Gnatenko Date: Thu, 15 Feb 2018 10:02:44 +0100 Subject: [PATCH] brp-mangle-shebangs: add support for whitespaces in file names Now it starts requiring bash instead of POSIX-compatible shell, but this is not a problem since other scripts in here do same. Signed-off-by: Igor Gnatenko --- brp-mangle-shebangs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/brp-mangle-shebangs b/brp-mangle-shebangs index 53038a5..9b25ed3 100755 --- a/brp-mangle-shebangs +++ b/brp-mangle-shebangs @@ -1,4 +1,4 @@ -#!/bin/sh -eu +#!/bin/bash -eu # If using normal root, avoid changing anything. if [ -z "$RPM_BUILD_ROOT" -o "$RPM_BUILD_ROOT" = "/" ]; then @@ -15,7 +15,8 @@ trim() { } fail=0 -for f in $(find -executable -type f | xargs --no-run-if-empty file -N --mime-type | grep -Po "^\K.+(?=: text/)"); do +while IFS= read -r -d $'\0' f; do + file -N --mime-type "$f" | grep -q -P ".+(?=: text/)" || continue # Remove the dot path="${f#.}" @@ -65,6 +66,6 @@ for f in $(find -executable -type f | xargs --no-run-if-empty file -N --mime-typ fi touch -d "$ts" "$f" -done +done < <(find -executable -type f -print0) exit $fail