mirror of
git://git.savannah.gnu.org/libtool.git
synced 2025-03-07 15:37:05 +08:00
* ltmain.in: create on-demand executable as $progdir/$$-$program,
and rename it to $progdir/$program only when it's finished, to avoid race conditions. We can still get the program linked multiple times, if multiple instances are started simultaneously and the program does not exist, but they are very unlikely to interfere with each other. There's still a possibility that one process removes the $program another has just created, and doesn't replace it before the other tries to run it, in a system whose `mv' is not atomic, so it will $rm then $mv, but so what? :-) Locking files have been avoided to prevent dead-locks in case they are left over after a reboot or crash.
This commit is contained in:
parent
40e8332d43
commit
231f7fd15f
12
ChangeLog
12
ChangeLog
@ -1,5 +1,17 @@
|
||||
1999-02-22 Alexandre Oliva <oliva@dcc.unicamp.br>
|
||||
|
||||
* ltmain.in: create on-demand executable as $progdir/$$-$program,
|
||||
and rename it to $progdir/$program only when it's finished, to
|
||||
avoid race conditions. We can still get the program linked
|
||||
multiple times, if multiple instances are started simultaneously
|
||||
and the program does not exist, but they are very unlikely to
|
||||
interfere with each other. There's still a possibility that one
|
||||
process removes the $program another has just created, and doesn't
|
||||
replace it before the other tries to run it, in a system whose
|
||||
`mv' is not atomic, so it will $rm then $mv, but so what? :-)
|
||||
Locking files have been avoided to prevent dead-locks in case they
|
||||
are left over after a reboot or crash.
|
||||
|
||||
* TODO: removed ILD, soon to be merged, and added convenience
|
||||
libraries docs
|
||||
|
||||
|
28
ltmain.in
28
ltmain.in
@ -2544,7 +2544,7 @@ static const void *lt_preloaded_setup() {
|
||||
fi
|
||||
|
||||
if test "$shlibpath_overrides_runpath" != yes; then
|
||||
compile_for_build_command=`echo "X$compile_command" | $Xsed -e "s%@BUILD_LIBDIRS_FLAGS@%$build_libdirs_flags%" -e "s%@BUILD_RPATH@%$build_rpath%" -e "s%@HARDCODE_BUILD_LIBDIRS@%$build_libdirs%" -e 's%@THISDIR@%\$thisdir%g' -e 's%@OUTPUT@%\$progdir/\$program%g'`
|
||||
compile_for_build_command=`echo "X$compile_command" | $Xsed -e "s%@BUILD_LIBDIRS_FLAGS@%$build_libdirs_flags%" -e "s%@BUILD_RPATH@%$build_rpath%" -e "s%@HARDCODE_BUILD_LIBDIRS@%$build_libdirs%" -e 's%@THISDIR@%\$thisdir%g' -e 's%@OUTPUT@%\$progdir/\$file%g'`
|
||||
fi
|
||||
|
||||
# Replace the output file specification.
|
||||
@ -2661,16 +2661,26 @@ else
|
||||
progdir=\"\$thisdir/$objdir/$objdir\"
|
||||
|
||||
if test ! -f \"\$progdir/\$program\" || \\
|
||||
{ newestfile=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
|
||||
test \"X\$newestfile\" != \"X\$progdir/\$program\"; }; then
|
||||
if test ! -d \"\$progdir\"; then
|
||||
$mkdir \"\$progdir\"
|
||||
else
|
||||
$rm \"\$progdir/\$program\"
|
||||
fi
|
||||
{ file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
|
||||
test \"X\$file\" != \"X\$progdir/\$program\"; }; then
|
||||
|
||||
file=\"\$\$-\$program\"
|
||||
|
||||
$rm \"\$progdir/\$file\""
|
||||
|
||||
echo >> $output "\
|
||||
|
||||
# link executable that uses uninstalled libraries
|
||||
(cd \$thisdir && $compile_for_build_command) || exit 1
|
||||
if (cd \"\$thisdir\" && $compile_for_build_command); then :
|
||||
else
|
||||
$rm \"\$progdir/\$file\"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
$mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
|
||||
{ $rm \"\$progdir/\$program\";
|
||||
$mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
|
||||
$rm \"\$progdir/\$file\"
|
||||
fi"
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user