delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/09/10/16:26:07

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 10 Sep 2010 22:25:44 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: rm -r removes directory but reports "cannot remove 'dir', directory not empty"
Message-ID: <20100910202544.GK16534@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <BAY158-w12043F32A41C6882CC70A2B1740 AT phx DOT gbl>
MIME-Version: 1.0
In-Reply-To: <BAY158-w12043F32A41C6882CC70A2B1740@phx.gbl>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT 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

On Sep 10 19:04, Saurabh T wrote:
> 
> This is with the latest cygwin and coreutils 8.5-2.
> 
> Good:
> > mkdir 1; echo $?
> 0
> > rm -fr 1; echo $?
> 0
> > ls 1
> ls: cannot access 1: No such file or directory
> 
> Bad:
> > mkdir 1; echo $?
> 0
> > rm -fr 1; echo $?
> rm: cannot remove '1': Directory not empty
> 1
> > ls 1
> ls: cannot access 1: No such file or directory

What is that I: drive?  What does `mount' print as filesystem type of
/cygdrive/i, and what does `/usr/lib/csih/getVolInfo /cygdrive/i'
print(*)?  I assume I: is not Samba, right?

Two problems.

- First, the file rename operation in the try_to_bin function fails with
  STATUS_INVALID_PARAMETER.  try_to_bin is only called if a sharing
  violation occured.  Obviously I can't tell where the sharing violation
  comes from.

  I assume that the file system on I: returns this error in place of
  another STATUS_SHARING_VIOLATION.  But I don't know.  I never saw a
  STATUS_INVALID_PARAMETER. from the rename function before.  The
  only other problem I can think of is that the filesystem chokes on
  the 64K buffer size of the FILE_RENAME_INFORMATION buffer.

- Second, apparently the actual "Directory not empty" error is generated
  artificially by rmdir.  There's code which test if the removed directory
  still exists after the OS call to remove it.  This works around a problem
  in Samba, which sometimes doesn't return an error if the directory can't
  be removed because it's not empty.  For some reason the directory still
  exists at that point in time, so you get the error.  It's not clear to
  me how to workaround this.  At least not as long as we have more info about
  the filesystem itself.


Corinna

(*) The getVolInfo tool is part of the csih package.

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

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