This came up while working on GCC. I'd like to offer this patch to mkinstalldirs so that it works as expected. Also, GCC would prefer that any local changes get upstream. :-)
If I need to do anything special copyright-wise, let me know. Alternatively, rather than commenting the stuff out, you could just delete it, which would obviate all copyright issues. -- Nathanael Nerode <neroden at gcc.gnu.org> US citizens: if you're considering voting for Bush, look at these first: http://www.misleader.org/ http://www.cbc.ca/news/background/arar/ http://www.house.gov/reform/min/politicsandscience/
I'd like to propose this patch for GCC 3.4; it fixes a stupid regression on Solaris 2.7 / Solaris 8, where mkdir -p is not thread-safe. The only problem is that mkinstalldirs is copied from automake. :-P Is this OK anyway? I'd actually like to commit this to mainline and src to fix the same problem. Do I have to get it committed to automake first instead, and worse, do I have to wait for a 'good' version of automake to be released and used? :-P I really would rather not deal with this in the other possible way (ad-hoc changes in various Makefiles), because I expect more such problems to appear in the future as long as we're using a non-thread-safe version of mkdir -p. If committing to a variant version of mkinstalldirs is not acceptable, perhaps I could create a derivative of mkinstalldirs under a different name and use *that* instead? * mkinstalldirs: Don't use mkdir -p. Index: mkinstalldirs =================================================================== RCS file: /cvs/gcc/gcc/mkinstalldirs,v retrieving revision 1.3 diff -u -r1.3 mkinstalldirs --- mkinstalldirs 20 Jul 2003 09:40:28 -0000 1.3 +++ mkinstalldirs 8 Feb 2004 07:49:21 -0000 @@ -50,20 +50,24 @@ 0) exit 0 ;; esac -case $dirmode in - '') - if mkdir -p -- . 2>/dev/null; then - echo "mkdir -p -- $*" - exec mkdir -p -- "$@" - fi - ;; - *) - if mkdir -m "$dirmode" -p -- . 2>/dev/null; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - fi - ;; -esac +# Solaris 8's mkdir -p isn't thread-safe! If you mkdir -p a/b and +# mkdir -p a/c at the same time, both will detect that a is missing, +# one will create a, then the other will try to create a and die with +# a "File exists" error. So we have to disable this code on Solaris 8. +#case $dirmode in +# '') +# if mkdir -p -- . 2>/dev/null; then +# echo "mkdir -p -- $*" +# exec mkdir -p -- "$@" +# fi +# ;; +# *) +# if mkdir -m "$dirmode" -p -- . 2>/dev/null; then +# echo "mkdir -m $dirmode -p -- $*" +# exec mkdir -m "$dirmode" -p -- "$@" +# fi +# ;; +#esac for file do