delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/01/27/13:27:10

X-Spam-Check-By: sourceware.org
Date: Fri, 27 Jan 2006 19:26:55 +0100
From: Alex Riesen <fork0 AT users DOT sourceforge DOT net>
To: Eric Blake <ericblake AT comcast DOT net>
Cc: cygwin AT cygwin DOT com
Subject: Re: cygwin-1.5.19-2: mkdir returns inconsistent errno
Message-ID: <20060127182655.GA6169@steel.home>
Reply-To: Alex Riesen <fork0 AT users DOT sourceforge DOT net>
References: <012620061525 DOT 1038 DOT 43D8EA05000B44680000040E22007358340A050E040D0C079D0A AT comcast DOT net> <81b0412b0601260821p2a0525dane12307a43e6897f1 AT mail DOT gmail DOT com>
Mime-Version: 1.0
In-Reply-To: <81b0412b0601260821p2a0525dane12307a43e6897f1@mail.gmail.com>
User-Agent: Mutt/1.5.6i
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Alex Riesen, Thu, Jan 26, 2006 17:21:21 +0100:
> > > > > 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! :)

This was a bit prematurely. There is a big problem with this aproach:
it changes current directory of the process. So you can't really use
it in multithreaded or signalled environment.
So chdir is not a real solution. Is it really that hard to workaround
the problem in cygwin?


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019