>From c50db415f06d3a29780fe9650654165f6fa28bf0 Mon Sep 17 00:00:00 2001 From: Paul Eggert
Date: Sun, 25 Aug 2019 18:51:26 -0700 Subject: [PATCH] install-sh: support -s with read-only source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem reported by Karl Berry in: https://lists.gnu.org/r/bug-gnulib/2019-08/msg00067.html * lib/install-sh: If -s is given, create the temporary file with $cp_umask so that âstripâ can write to it. --- lib/install-sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/install-sh b/lib/install-sh index 8175c640f..1f5cdccc7 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -451,7 +451,16 @@ do trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + (umask $cp_umask && + { test -z "$stripcmd" || { + if test -z "$doit"; then + : >"$dsttmp" # No need to fork-exec 'touch'. + else + $doit touch "$dsttmp" + fi + } + } && + $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # -- 2.21.0