delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/01/23/05:47:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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
From: "Chris January" <chris AT atomice DOT net>
To: <cygwin AT cygwin DOT com>
Subject: RE: Bug in rm -r with locked files
Date: Thu, 23 Jan 2003 10:47:32 -0000
Message-ID: <LPEHIHGCJOAIPFLADJAHCENDDDAA.chris@atomice.net>
MIME-Version: 1.0
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
Importance: Normal
In-Reply-To: <20030121201944.GE17833@redhat.com>

> On Tue, Jan 21, 2003 at 11:25:19AM -0800, Randall R Schulz wrote:
> >Shankar,
> >
> >At 11:05 2003-01-21, Shankar Unni wrote:
> >>lhall AT pop DOT ma DOT ultranet DOT com wrote:
> >>>You may find the 'handle' utility from www.sysinternal.com a handy
> >>>(no pun intended :-) ) tool for determining which files are opened
> >>>by which processes.
> >>
> >>I don't think that was the primary issue.  The issue was that
> if a process
> >>is using a directory as its working directory (chdir()'ed into it), "rm
> >>-rf" goes into an infinite loop attempting to remove the
> directory (rather
> >>than print an error and move on).
> >>
> >>Definitely a bug, and still a bug.
> >
> >
> >That, in fact, is a presumption. The Cygwin principals are aware of this
> >behavior and it is not new. It is a trade-off required to get POSIX-like
> >behavior from the "unlink" system call as emulated by Cygwin.
> >
> >Please review the discussions under the subject "Infinite Loop
> In "rm -fr"
> >When Busy File Encountered" on April 6, 2002 and "REPOST: unlink
> semantics"
> >from April 10, 2002.
> >
> >I'm not an expert, but this has come up more than once (I initiated the
> >April 6 round of discussions) and the upshot is that given the
> mismatch of
> >API semantics between Windows and POSIX, this is the best that
> can be done.
>
> Correct.  I knew that if I waited long enough Randall would
> probably reply.
> :-)
>
> It's not a completely intractable problem.  I think that someone (Chris
> January?) provided a workaround at one point.  "cygserver" could also
> provide a possible solution someday.

The best solution, IIRC, was to move the locked files elsewhere on the same
volume (which should be allowed) if they can't be unlinked, and then unlink
them later. So there would be a directory of files waiting to die if you
like :) Obviously you'd have to give them unique names, but you can just use
random numbers.

Chris


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