delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/11/21:12:36

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:mime-version
:content-type:content-transfer-encoding; q=dns; s=default; b=dvc
E9OJ4rlVlv6J6Ki3u65BgIj5BXp/T6KNCKJLdRwJL9VAojJnoMpqARFihzuiTPtE
PJ7qDvm/S69Lw7XRDGFjy0h2IeRhS6DkU8GENgh7eiymdCpgTTMl7At8D3EMDpkI
j8PmgPm4Iz6ekYW7JiCXPy2OH99R3hS6F1jGHRPA=
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:mime-version
:content-type:content-transfer-encoding; s=default; bh=N8NX/YLMF
pEyJi2VCVaXUUtvQpI=; b=mQiVemf188n1BTlDdh7HbVhdlw+I41ADTh8Ro3p5b
XTTYfQ1CiMLPEbZ7tm1naQSIUSVU46KLb+1dmJew20rBPrhuVTqYnzwy5JZCDLbg
Tkg8KnoD0Mhdkt2Z10seVRXdme5aYdQpwNwz5P8lg2vYqpCaTfokkAMSrQqsN6l5
FU=
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=1.1 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,LIKELY_SPAM_FROM,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=etc=e2, H*RU:sk:mail.nu, Hx-spam-relays-external:sk:mail.nu, H*r:sk:mail.nu?=
X-HELO: mail.nullprogram.com
Date: Tue, 11 Jul 2017 21:12:09 -0400
From: Christopher Wellons <wellons AT nullprogram DOT com>
To: cygwin AT cygwin DOT com
Subject: mkdir(2) prefers EACCES over EEXIST
Message-ID: <20170712011209.GK17540@nullprogram.com>
MIME-Version: 1.0
User-Agent: Mutt/1.5.23 (2014-03-12)

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 
directory couldn't have been created in the first place. For example, 
this is the typical situation for /cygdrive/c:

    mkdir("/cygdrive/c", 0700);
    // errno == EACCES

Or from the shell:

    $ mkdir /cygdrive/c
    mkdir: cannot create directory ‘/cygdrive/c’: Permission denied

Compare that to Linux or *BSD (giving EEXIST):

    $ mkdir /etc
    mkdir: cannot create directory ‘/etc’: File exists

    $ mkdir /etc
    mkdir: /etc: File exists

This behavior seems to be permitted by POSIX — both are valid reasons 
for this system call to fail — but it's a surprising result. I'd expect 
existence to take priority.

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

- Raw text -


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