Commit Graph

4 Commits

Author SHA1 Message Date
Tim Cuthbertson 2e1bb87af2 install.sh: avoid creating symlinks with restricted permissions
Linux and most systems do not have symlink permissions, but some
systems, including MacOS, do, and creation of the symlink with umask
set to 0777 makes the symlink inaccessible on such systems.

clear umask when making a symlink so that the behavior is uniform.
2024-02-03 19:57:30 -05:00
Rich Felker 7cbb6f70c8 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.
2014-01-15 22:29:13 -05:00
Rich Felker ceacb6a4cf fix mv usage in install.sh to avoid bogus interactive prompting 2013-12-03 19:01:40 -05:00
Rich Felker e678fc6f32 replace system's install command with a shell script
the historical (non-standardized) install command is really
inappropriate for installing binaries/libraries on a system that
utilizes memory-mapped executable files. rather than replacing an
existing file atomically, it overwrites the existing file. this can
cause running programs to see a partially-modified version of the
file, resulting in unpredictable behavior, or SIGBUS. a MAP_COPY mode
for mmap would get around this problem, but Linux lacks MAP_COPY.

the shell script added with this commit works around the problem by
writing temporary files and moving them into place. unlike the
historical install utility, it also support a -l option for installing
a symbolic link atomically, via the same method.
2013-08-17 22:21:11 -04:00