delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/09/09/11:49:30

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <20010909154916.44360.qmail@web10505.mail.yahoo.com>
Date: Sun, 9 Sep 2001 08:49:16 -0700 (PDT)
From: Rick Rankin <rick_rankin AT yahoo DOT com>
Subject: Re: 1.3.2 rmdir fails if CWD is in the directory to be deleted?
To: Randall R Schulz <rrschulz AT cris DOT com>, cygwin AT cygwin DOT com
In-Reply-To: <5.1.0.14.2.20010908074822.0292ce60@pop3.cris.com>
MIME-Version: 1.0

But there's no way the original code can work. If you'll recall, it was

mkdir("test");
chdir("test");
rmdir("test");

After the chdir("test") line, there is no longer a directory called "test" at
the current level of the directory hierarchy. How then can rmdir("test") work?
If it works on *any* system, my contention would be that it's a bug. That's why
I suggested

rmdir("../test");

which may well work on some systems. In fact, I seem to recall having seen it
work on some systems, AIX and Solaris in particular.

--Rick

--- Randall R Schulz <rrschulz AT cris DOT com> wrote:
> Rick,
> 
> You should try it. On many Unix systems it will work just fine. After the 
> rmdir call, no call that uses a relative file name will work, however, 
> since the directory must have been empty to be removed and in doing so the 
> .. link would have been removed.
> 
> This applies to "classic" implementations on the Unix file system. Chris 
> has pointed out that IRIX does not behave this way. Since those details are 
> not part of the API specifications, the implementers get to do what they 
> please. That's what it's all about when it comes to writing specifications 
> (saying everything you mean and are willing to commit to and nothing you 
> are not).
> 
> Randall Schulz
> Mountain View, CA USA
> 
> 
> At 22:48 2001-09-07, Rick Rankin wrote:
> >Hmm. It looks to me like this should fail, even under Unix. Once you've 
> >chdir'd
> >into test, it no longer exists at the current directory level. Shouldn't the
> >sequence be
> >
> >mkdir("test");
> >chdir("test");
> >rmdir("../test");
> >
> >Of course, even this will fail under Windows because Windows won't allow the
> >current directory to be deleted if it's in use by any process.
> >
> >--Rick
> 


__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger
http://im.yahoo.com

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.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