delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/09/29/08:31:32

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
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
Date: Thu, 29 Sep 2005 14:31:02 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: bug in rmdir(2)
Message-ID: <20050929123102.GA23334@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <092820052226 DOT 6432 DOT 433B18B2000A598D0000192022007358340A050E040D0C079D0A AT comcast DOT net> <20050929075025 DOT GA19713 AT calimero DOT vinschen DOT de> <433BDB6D DOT 1010806 AT byu DOT net>
Mime-Version: 1.0
In-Reply-To: <433BDB6D.1010806@byu.net>
User-Agent: Mutt/1.4.2i

On Sep 29 06:17, Eric Blake wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> According to Corinna Vinschen on 9/29/2005 1:50 AM:
> >>The fix to rmdir(2) is easy - check for a trailing / or /. or /..
> >>before handing the name off to the complex path processing
> >>code, and fail with EINVAL if so.  rmdir(2) isn't called often
> >>enough for this to slow down everything else, and there are
> >>no Windows API calls in this failure mode, and in return you
> >>get POSIX compliance.
> > 
> > 
> > Just a trailing slash is fine, btw.  Try this on any POSIXy system.
> 
> It is still inconsistent on POSIXy systems - compare Solaris 8 vs. Solaris 10:
> 
> 8> mkdir a
> 8> ln -s a b
> 8> rmdir b/
> rmdir: directory "b/": Path component not a directory
> 
> 10> mkdir a
> 10> ln -s a b
> 10> rmdir b/
> 10> ls ?
> b
> 
> However, I'm not sure in Solaris 8 whether the trailing slash was removed
> by rmdir(1) before calling rmdir(2), or whether rmdir(2) errored out with
> ENOTDIR.  But Solaris 10 certainly removed the referrant directory,
> leaving the symlink dangling.

Try the actual call rmdir(2) and especially read the rmdir entry in SUSv3:
http://www.opengroup.org/onlinepubs/009695399/functions/rmdir.html

There's no text restricting the behaviour in case of "dir/", there's just
this:

  If the path argument refers to a path whose final component is either
  dot or dot-dot, rmdir() shall fail.

On Linux, rmdir(2) consequentially allows removing "dir/".

The "path/.." case is also already covered by returning ENOTEMPTY or
EBUSY, whatever Windows returns.  So there's only the "path/." case
left to check.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat, Inc.

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