]> granicus.if.org Git - php/commitdiff
fix bug #51076 (race condition in shtool's mkdir -p)
authorMichael Wallner <mike@php.net>
Tue, 8 Oct 2013 06:37:08 +0000 (08:37 +0200)
committerMichael Wallner <mike@php.net>
Tue, 8 Oct 2013 06:37:08 +0000 (08:37 +0200)
NEWS
build/shtool

diff --git a/NEWS b/NEWS
index 796f82f207847687c9493b74371754aec9516e0c..6649a4965acf98288fbfb5428fbb4e9f68c3c41b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@ PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? ??? 2013, PHP 5.5.5
 
+- Buildsystem:
+  . Fixed bug #51076 (race condition in shtool's mkdir -p implementation).
+    (Mike, Raphael Geissert)
+
 - Core:
   . Fixed bug #64979 (Wrong behavior of static variables in closure generators).
     (Nikita)
index 684a01f5df968e6d497442db7a4425349dc26d27..fc6ae1e6efbbb0d3e4f103af3e8ed197c3542151 100755 (executable)
@@ -1003,7 +1003,14 @@ mkdir )
                     if [ ".$opt_t" = .yes ]; then
                         echo "mkdir $pathcomp" 1>&2
                     fi
-                    mkdir $pathcomp || errstatus=$?
+                                       # See https://bugs.php.net/51076
+                                       # The fix is from Debian who have sent it
+                                       # upstream, too; but upstream seems dead.
+                    mkdir $pathcomp || {
+                        _errstatus=$?
+                        [ -d "$pathcomp" ] || errstatus=${_errstatus}
+                        unset _errstatus
+                    }
                     if [ ".$opt_o" != . ]; then
                         if [ ".$opt_t" = .yes ]; then
                             echo "chown $opt_o $pathcomp" 1>&2