texlive[42426] Master/texmf-dist/web2c/mktexdir: sync with source
commits+karl at tug.org
commits+karl at tug.org
Wed Nov 2 22:35:12 CET 2016
Revision: 42426
http://tug.org/svn/texlive?view=revision&revision=42426
Author: karl
Date: 2016-11-02 22:35:12 +0100 (Wed, 02 Nov 2016)
Log Message:
-----------
sync with source (for race condition fix attempt)
Modified Paths:
--------------
trunk/Master/texmf-dist/web2c/mktexdir
Modified: trunk/Master/texmf-dist/web2c/mktexdir
===================================================================
--- trunk/Master/texmf-dist/web2c/mktexdir 2016-11-02 21:34:11 UTC (rev 42425)
+++ trunk/Master/texmf-dist/web2c/mktexdir 2016-11-02 21:35:12 UTC (rev 42426)
@@ -1,12 +1,13 @@
#!/bin/sh
-# mkinstalldirs (now mktexdir) -- make directory hierarchy.
+# mktexdir (was mkinstalldirs) -- make directory hierarchy.
# Author: Noah Friedman <friedman at prep.ai.mit.edu>, created: 1993-05-16.
# Public domain.
#
# Modified for sticky directory creation, --help, --version, more,
# by Thomas Esser, Karl Berry, Olaf Weber, et al.
+# Maintained as part of TeX Live, http://tug.org/tex-live.
-version='$Id: mktexdir 34656 2014-07-18 23:38:50Z karl $'
+version='$Id: mktexdir 42425 2016-11-02 21:34:11Z karl $'
progname=`echo $0 | sed 's%.*/%%'`
# preferentially use subprograms from our own directory.
@@ -50,7 +51,18 @@
pathcomp="$pathcomp$d"
if test ! -d "./$pathcomp"; then
- mkdir "./$pathcomp" || { errstatus=$?; break; }
+ # This shell stuff is not atomic, therefore ./$pathcomp
+ # may have been created in another process and this mkdir will
+ # fail despite the above test, so do it silently:
+ mkdir "./$pathcomp" >/dev/null 2>&1
+
+ # So, if ./$pathcomp is a directory now, call it good.
+ if test ! -d "./$pathcomp"; then
+ # Otherwise, presumably it's a real error. Do the mkdir again
+ # and let the error be seen, and quit the loop.
+ # (Report at https://bugs.debian.org/794228.)
+ mkdir "./$pathcomp" || { errstatus=$?; break; }
+ fi
chmod `kpsestat ${MT_APPEND_MASK} "$pathcomp"/..` "./$pathcomp"
fi
@@ -59,3 +71,6 @@
done
exit $errstatus
+
+# P.S. We don't want to rely on mkdir -p, because of possible
+# portability programs. See current mkinstalldirs source (in Automake).
More information about the tex-live-commits
mailing list