diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-25 18:51:26 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2019-08-26 14:45:03 -0700 |
commit | d89a1aadedd26b8caf97f7202766706b2480f524 (patch) | |
tree | 4a28203cef3db84d2fad0f62626c9fe2f4bff231 /lib | |
parent | 20f739e6f739f67bb8afafffaaa68b388769b100 (diff) | |
download | automake-d89a1aadedd26b8caf97f7202766706b2480f524.tar.gz |
install-sh: support -s with read-only source
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.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/install-sh | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/install-sh b/lib/install-sh index 8175c640f..20d8b2eae 100755 --- a/lib/install-sh +++ b/lib/install-sh @@ -451,7 +451,18 @@ 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" || { + # Create $dsttmp read-write so that cp doesn't create it read-only, + # which would cause strip to fail. + 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. # |