www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/12/04:46:35

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=iejeZNCtw0ermihBuotd9XtWIsSkWLAA9vna0IoLB7a16Hey3wrd3
sgwXwA5PgauDespqSzLCFA+PeLSWgNNijqLk+0vPJMUnI3fyWLApxr0z3+Q+xaVO
s95+7f0oddHKOVJBDftOr/JdeCZxYDtDLAFVhAyTbhAY89MwN6U4ok=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=iei/TViXNhpTvOub4cNeWg2sbDg=; b=u9aLBKqvyN9Kp1rknUlm+GhkqtUP
p+ta1SoDd4+UTVe+FzQhLaheRL2sh/LqpeCXR4AhAQwade3cSmfBt5UFSEMMiht/
UPvgavgOmDj30b71tJDPLnQSL6ds7EfqmGxWlZarJ+GyhPChJ3YCJ/Mu2Zs5Uq6U
sIRKakw2Ged45D0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-101.9 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=etc=e2, eacces, wellons, eexist?=
X-HELO: drew.franken.de
Date: Wed, 12 Jul 2017 10:45:46 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: mkdir(2) prefers EACCES over EEXIST
Message-ID: <20170712084546.GF30071@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <20170712011209 DOT GK17540 AT nullprogram DOT com>
MIME-Version: 1.0
In-Reply-To: <20170712011209.GK17540@nullprogram.com>
User-Agent: Mutt/1.8.0 (2017-02-23)

--qOrJKOH36bD5yhNe
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Jul 11 21:12, Christopher Wellons wrote:
> This isn't _really_ a bug, more of an oddity. Calling mkdir(2) on an
> existing directory will fail with EACCES instead of EEXIST if the directo=
ry
> couldn't have been created in the first place. For example, this is the
> typical situation for /cygdrive/c:
>=20
>    mkdir("/cygdrive/c", 0700);
>    // errno =3D=3D EACCES
>=20
> Or from the shell:
>=20
>    $ mkdir /cygdrive/c
>    mkdir: cannot create directory =E2=80=98/cygdrive/c=E2=80=99: Permissi=
on denied
>=20
> Compare that to Linux or *BSD (giving EEXIST):
>=20
>    $ mkdir /etc
>    mkdir: cannot create directory =E2=80=98/etc=E2=80=99: File exists
>=20
>    $ mkdir /etc
>    mkdir: /etc: File exists
>=20
> This behavior seems to be permitted by POSIX =E2=80=94 both are valid rea=
sons for
> this system call to fail =E2=80=94 but it's a surprising result. I'd expe=
ct
> existence to take priority.

That's a result of calling the Windows function without prior check for
existence.  The Windows function apparently prefers it's variation of
EACCES over EEXIST, *iff* the target of the function is a drive.

I don't think it's worth to add a check to mkdir for such a border
case, just to prefer one error code over another.


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--qOrJKOH36bD5yhNe
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJZZeG6AAoJEPU2Bp2uRE+gr0kQAKK0TNPlAHCfoOQVmSDJ9eFw
v6tC22fZiBFo9eKXLPBSVpenpGjPcmqWzv3Kov+TDKmJL6Gmqdvqh9EyWXCOLvl9
8Q0/xO1s26CXGp1c+RcXGRlyWt9VViCY8iUajPnG0tvlXPlFkLU+ZJNxpZxyVyKo
aAYvxH6oIShVd+Uvn7a9HgLagIUgE0grfeN3QxtaN3MbyAmBaWvDpfWcnR+qeU5L
i+DB1VMaJ5zuYA+tl27FSSSjccQwzvUHvFJReIQ40bCWGvhLu4T6DP1z/VMetlqB
Ioprsz+chcEaeU0slInN1qAQraZTAs0Rgqq0aLjoorMsybEHIjP+f9dghI2zXzYb
XVuWZ1rNHhgL0y4KQd3hV99S2BCvvw4QY9M2DY7lhRN0Qrsp9nTGQHK2lSCbEW5o
ggr4nsMFsHkqwMZ+plYx3kz1+2a3dEMf5LsD8uFIqoMzassenIHBpRR2TE3UNVqM
oeXnVyp/En1Zw2ktxinsWfzYGgBwGpHoYvx0AhISV2p7QSImKh33seAQnpQ3BNnw
+bUZoZXIyiI1/byPp2s7VbdOkEeWuQL++KQWgg6fBP1tCcCW8ed3sl4VKXheImbF
QEBem10uSyK3UhWb1tpmOyTjBCw2/XbqPCe6qvfbpl33YtMoCqf1lpi3OOif3aZD
OUv4AuEPTIzKH0+fbd52
=B/05
-----END PGP SIGNATURE-----

--qOrJKOH36bD5yhNe--

- Raw text -


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