delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/02/03/11:38:42

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Fri, 3 Feb 2012 17:37:50 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: rm fails but returns success
Message-ID: <20120203163750.GA10022@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4F2C0533 DOT 2070802 AT lysator DOT liu DOT se> <20120203161701 DOT GE30293 AT calimero DOT vinschen DOT de> <4F2C0AF8 DOT 8020102 AT lysator DOT liu DOT se>
MIME-Version: 1.0
In-Reply-To: <4F2C0AF8.8020102@lysator.liu.se>
User-Agent: Mutt/1.5.21 (2010-09-15)
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 Feb  3 17:27, Peter Rosin wrote:
> Corinna Vinschen skrev 2012-02-03 17:17:
> > On Feb  3 17:02, Peter Rosin wrote:
> >> Hi!
> >>
> >> I have this annoying leftover file from a automake testsuite run.
> >> I don't know if it was created by an MSYS process or a Cygwin
> >> process, but I can't get rid of it.  I can't take ownership of
> >> it either, not even as admin.  I haven't tried stopping all
> >> MSYS/Cygwin processes yet, nor rebooting, but I'd rather not.
> >>
> >> Any help with that is appreciated.  No, not rebooting :-)
> >>
> >> However, that is not really why I'm writing, I'm writing to
> >> report the following bug related to the above file.
> >>
> >> $ uname -a
> >> CYGWIN_NT-6.1-WOW64 peda-pc 1.7.10s(0.259/5/3) 20120123 00:15:09 i686 Cygwin
> >> $ ls -l aclibobj.log-t
> >> -rw-r----- 1 ???????? ???????? 2113 Jan 31 16:09 aclibobj.log-t
> >> $ rm aclibobj.log-t; echo $?
> >> rm: remove write-protected regular file `aclibobj.log-t'? yes
> >> 0
> > 
> > Send an strace of this, please.  One reason that rm (better: unlink(2))
> > reports success is if the file is still in use by another process but
> > it's already marked as "delete pending" in the OS.  This should only
> > occur if a non-Cygwin process is still holding a handle to the file.
> 
> Here's the strace.
> [...]
>    17   11885 [main] rm 16748 unlink_nt: Trying to delete \??\C:\cygwin\home\peda\automake\tests\aclibobj.log-t, isdir = 0
>    26   11911 [main] rm 16748 unlink_nt: Delete \??\C:\cygwin\home\peda\automake\tests\aclibobj.log-t already pending
>    16   11927 [main] rm 16748 unlink_nt: \??\C:\cygwin\home\peda\automake\tests\aclibobj.log-t, return status = 0x0
>    15   11942 [main] rm 16748 unlink: 0 = unlink(/home/peda/automake/tests/aclibobj.log-t)

Yup, as I supected.  The delete is pending already.  Therefore the file
is logically already successfully deleted.  Only the fact that some
importunate non-Cygwin process is still holding an open handle to the
file forestalls its disappearance.

There's nothing at all you can do about that, other than to identify the
process holding the open handle and kill it.


Corinna

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