[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: mkdir -p -- minor cleanup

From: Paul Eggert
Subject: Re: mkdir -p -- minor cleanup
Date: Mon, 24 Apr 2006 13:36:43 -0700
User-agent: Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux)

Stepan Kasal <address@hidden> writes:

> All my complaints were considered, and we have Alexandre's approval,
> so I guess you could check it in.

OK, thanks, I did that.

If I understand you and Ralf correctly about race conditions, here is
a proposed patch to should fix the condition on POSIX conforming
hosts.  On older hosts there's no hope that I can see in general, but
it's not worth worrying about these ancient hosts at this point.  I
hope this addresses Ralf's concerns.

2006-04-24  Paul Eggert  <address@hidden>

        * lib/install-sh: Close a race condition reported by Ralf
        Wildenhues and Stepan Kasal.  There is still a race condition
        on hosts that predate POSIX 1003.1-1992, but we can't help this.

--- install-sh.~1.31.~  2006-04-24 12:58:37.000000000 -0700
+++ install-sh  2006-04-24 13:34:41.000000000 -0700
@@ -340,13 +340,16 @@ do
        if test ! -d "$pathcomp"; then
-         $mkdirprog "$pathcomp"
+         if $posix_mkdir; then
+           $mkdirprog -m "$mkdir_mode" -p -- "$dstdir" && break
+         else
+           $mkdirprog "$pathcomp" && obsolete_mkdir_used=true
+         fi
          # Don't fail if two instances are running concurrently.
          test -d "$pathcomp" || exit 1
-      obsolete_mkdir_used=true

reply via email to

[Prev in Thread] Current Thread [Next in Thread]