Package: shtool
Version: 2.0.8-5

Hi,

There's a race condition on the mkdir -p implementation, which can make 
parallel executions fail.
PHP ships its own copy of shtool (where this bug has already been fixed,) but 
we can not switch to the system's shtool before this bug is fixed there too.

I reported the bug to upstream (including a copy of our patch) but never got a 
reply, maybe you are luckier.

I'm attaching the patch we are using.

Cheers,
-- 
Raphael Geissert - Debian Developer
www.debian.org - get.debian.net
Description: Workaround a race condition in shtool's mkdir -p
 This workaround can be affected by another race condition where a
 different process running under a different user creates the directory,
 which would make the chown/chmod calls fail.
 .
 This is the version of the patch sent to shtool upstream.
Origin: vendor
Forwarded: yes
Last-Update: 2010-02-18

Index: php/build/shtool
===================================================================
--- php.orig/build/shtool
+++ php/build/shtool
@@ -991,7 +991,11 @@ mkdir )
                     if [ ".$opt_t" = .yes ]; then
                         echo "mkdir $pathcomp" 1>&2
                     fi
-                    mkdir $pathcomp || errstatus=$?
+                    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

Reply via email to