This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin-1.5.19-2: mkdir returns inconsistent errno


On 1/26/06, Eric Blake <ericblake@comcast.net> wrote:
> > mkdir (also syscall) return "Permission denied" when its argument refers to
> > a mountpoint  at the top of windows drive (probably also a windows mount,
> > I haven't tried).
> > For example:
> > $ mount d: /d
> > $ mkdir /
> > mkdir: cannot create directory `/': File exists
> > $ mkdir /d
> > mkdir: cannot create directory `/d': Permission denied
> > $ mkdir /d/tmp
> > mkdir: cannot create directory `/d/tmp': File exists
>
> I raised this issue before, and the conclusion was that
> POSIX permits this behavior (the mkdir must fail, but
> is permitted to fail for ANY of the permissible errno
> values that apply to the situation when more than
> one failure mode is present).  Therefore, it is highly
> likely that no change will be made to cygwin.

Pity.

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

No, I don't think it is a bug in git, or in any code which
expects EEXIST from mkdir in case an entry actually
just plain does exist.

> This is not even cygwin-specific.  It is possible on
> Linux to have /usr mounted on a read-only filesystem,
> then /usr/local mounted in a writable location,
> such that the call "mkdir -p /usr/local/dir" will get
> EROFS on the /usr component rather than EEXIST
> (trust me - the coreutils code for mkdir faced this
> very same issue in 5.90, and was fixed in time for
> the current 5.93).

Are you sure? Linux 2.6.15. It correctly reports EEXIST
on /usr and /usr/local and creates /usr/local/dir.
I'd consider that a bug, if it were otherwise. The reason
of racing alone if enough.

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]