From: Rich Felker Date: Thu, 16 Jan 2014 03:29:13 +0000 (-0500) Subject: fix system breakage window during make install due to permissions X-Git-Tag: v1.0.0~85 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7cbb6f70c8fe711644ec0dbede1973cc6641a283;p=oweals%2Fmusl.git fix system breakage window during make install due to permissions install.sh was wrongly waiting until after atomically replacing the old file to set the correct permissions on the new file. in the case of the dynamic linker, this would cause a dynamic-linked chmod command not to run (due to missing executable permissions on the dynamic linker) and thus leave the system in an unusable state. even if chmod is static-linked, the old behavior had a race window where dynamic-linked programs could fail to run. --- diff --git a/tools/install.sh b/tools/install.sh index 4e5a8b9f..d913b60b 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -51,6 +51,7 @@ if test "$symlink" ; then ln -s "$1" "$tmp" else cat < "$1" > "$tmp" +chmod "$mode" "$tmp" fi mv -f "$tmp" "$2" @@ -60,6 +61,4 @@ printf "%s: %s is a directory\n" "$0" "$dst" 1>&2 exit 1 } -test "$symlink" || chmod "$mode" "$2" - exit 0