This is the mail archive of the mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: infinite loop in rm -fr (revisited)

> >>#!/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'.
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.


Unsubscribe info:
Bug reporting:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]