diff options
Diffstat (limited to 'Master')
-rwxr-xr-x | Master/texmf-dist/web2c/mktexdir | 21 |
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). |