delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/07/02/16:16:05

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
X-WM-Posted-At: avacado.atomice.net; Tue, 2 Jul 02 21:04:59 +0100
Message-ID: <018e01c22203$be757450$0100a8c0@advent02>
From: "Chris January" <chris AT atomice DOT net>
To: <cygwin AT cygwin DOT com>
References: <3D21F96C DOT 50603 AT hekimian DOT com> <00d001c221fe$e5b242f0$0100a8c0 AT advent02> <3D220183 DOT 50700 AT hekimian DOT com>
Subject: Re: infinite loop in rm -fr (revisited)
Date: Tue, 2 Jul 2002 21:04:59 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

> >>#!/bin/bash
> >>trap "cd /; rm-orig -fr /tmp/xxx.dir" 0
> >>mkdir /tmp/xxx.dir
> >>exec >/tmp/xxx.dir/info
>
> > I tried to look into this and typed:
> > strace bash -c ./loop
> > which prompty resulted in bash segfaulting. :(((
>
> Not that it has anything to do with your segfault,
> probably, but be aware of the typo in my script above:
> It should be "rm -fr", not "rm-orig -fr".  That was something
> related to my debugging.
>
> I know for sure that Windows NT does not like deleting files
> that are open, so I would guess that there is a basic difference
> here with UNIX.  It would be nice to find a workaround.
Possible solutions:
1. rename the original file in the directory with a 'special name'.
e.g.
if deleting file1 and file1 is in use, rename to ...---file1---....
Files matching this pattern would not be returned by readdir.
2. rename the original file to a special 'holding' directory for pending
deleted files.
3. in file access routines, pretend a file does not exist if it is present
in delqueue. (e.g. check could be added to path_conv::check). Doesn't cope
with another file being created with the same name.

None of the above are ideal.

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