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: List-Subscribe: List-Archive: List-Post: List-Help: , 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 To: cygwin AT cygwin DOT com Subject: mkdir(2) prefers EACCES over EEXIST Message-ID: <20170712011209.GK17540@nullprogram.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit 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