summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-11-02 21:35:12 +0000
committerKarl Berry <karl@freefriends.org>2016-11-02 21:35:12 +0000
commita132f019fb73754e8e15d500321e635b51486ee3 (patch)
tree931f8b4b56c8b9422549d516a404524e43e2235c /Master/texmf-dist
parent1bcee5c5372991e01be888bcf448b8f41f030f93 (diff)
sync with source (for race condition fix attempt)
git-svn-id: svn://tug.org/texlive/trunk@42426 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rwxr-xr-xMaster/texmf-dist/web2c/mktexdir21
1 files changed, 18 insertions, 3 deletions
diff --git a/Master/texmf-dist/web2c/mktexdir b/Master/texmf-dist/web2c/mktexdir
index f39408b4c1f..86d34f81df7 100755
--- a/Master/texmf-dist/web2c/mktexdir
+++ b/Master/texmf-dist/web2c/mktexdir
@@ -1,12 +1,13 @@
#!/bin/sh
-# mkinstalldirs (now mktexdir) -- make directory hierarchy.
+# mktexdir (was mkinstalldirs) -- make directory hierarchy.
# Author: Noah Friedman <friedman@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 @@ do
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 @@ do
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).