Skip to content

Commit 7cbb6f7

Browse files
committed
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.
1 parent 50a5098 commit 7cbb6f7

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

tools/install.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ if test "$symlink" ; then
5151
ln -s "$1" "$tmp"
5252
else
5353
cat < "$1" > "$tmp"
54+
chmod "$mode" "$tmp"
5455
fi
5556

5657
mv -f "$tmp" "$2"
@@ -60,6 +61,4 @@ printf "%s: %s is a directory\n" "$0" "$dst" 1>&2
6061
exit 1
6162
}
6263

63-
test "$symlink" || chmod "$mode" "$2"
64-
6564
exit 0

0 commit comments

Comments
 (0)