X-Spam-Check-By: sourceware.org
Message-ID: <81b0412b0601260821p2a0525dane12307a43e6897f1@mail.gmail.com>
Date: Thu, 26 Jan 2006 17:21:21 +0100
From: Alex Riesen <raa.lkml@gmail.com>
To: Eric Blake <ericblake@comcast.net>
Subject: Re: cygwin-1.5.19-2: mkdir returns inconsistent errno
Cc: cygwin@cygwin.com
In-Reply-To: <012620061525.1038.43D8EA05000B44680000040E22007358340A050E040D0C079D0A@comcast.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: inline
References: <012620061525.1038.43D8EA05000B44680000040E22007358340A050E040D0C079D0A@comcast.net>
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
Precedence: bulk
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie.com@cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id k0QGLWSY020817

On 1/26/06, Eric Blake <ericblake@comcast.net> wrote:
> > > > This is highly unexpected, does not match linux behaviour (it returns EEXIST),
> > > > and actually breaks git (git clone, creation of pathnames, to be precise).
> > >
> > > Then git has a bug.  Report it there.  To be portable
> > > when making pathnames, you must first check
> > > for directory existance rather than relying on an
> > > errno of EEXIST to tell you the directory exists.
> >
> > How do you do it race-free?
>
> chdir().  If chdir() succeeded, then the directory existed,
> regardless of the errno that mkdir() reported.
> Take a look at gnulib's mkdir-p.c module:
> http://cvs.savannah.gnu.org/viewcvs/gnulib/lib/mkdir-p.c?rev=1.5&root=gnulib&view=auto

Very interesting! Thank you for this and the other references.
I'm given hope! :)

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


