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

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

# Re: Weird directories on Windows share when using rm to delete a directory

On Jul  2 15:28, Corinna Vinschen wrote:
> On Jul  1 15:28, Eric Blake wrote:
> > On 07/01/2010 03:24 PM, Slide wrote:
> > > I am seeing a VERY odd problem. If I run "/usr/bin/rm -rf
> > > //computer/share/path/to/dir" to remove a directory on a network
> > > share. I get some directories created with names like
> > > .XXXfffff8a0015e3b00c65f07a9f20c7a31 at the ROOT of the share (where
> > > XXX is unprintable character with the value 0x3f). I ran the command
> > > with strace, but didn't see anything in there that would point to why
> > > the directory is created.
> > >
> > > If I run the corresponding Windows command "rmdir /s /q
> > > \\computer\share\path\to\dir" I do NOT see the same thing occur, so
> > > something in Cygwin is causing this issue. I am running Cygwin 1.7
> > > updated today.
> >
> > This is due to cygwin emulating the ability to delete a file that is
> > still open.  Since windows doesn't directly allow it, cygwin instead
> > renames it out of the way, and relies on windows delete-on-close
> > semantics to get rid of that temporary name after everything finally
> > lets go of the file.  But if the delete-on-close stuff isn't working for
> > your particular network share, [...]
>
> Sorry Eric, but that's not the problem.
>
> Cygwin does what you say *only* for local drives.  [...]

Oh boy, scratch this.

I didn't remember that I implemented it exactly as described for remote
drives.

*blush*

I just read my longish comment in the source code which describes
what happens:

/* Create hopefully unique filename.
Since we have to stick to the current directory on remote shares, make
the new filename at least very unlikely to match by accident.  It starts
with ".cyg", with "cyg" transposed into the Unicode low surrogate area
starting at U+dc00.  Use plain ASCII chars on filesystems not supporting
Unicode.  The rest of the filename is the inode number in hex encoding
and a hash of the full NT path in hex.  The combination allows to remove
multiple hardlinks to the same file. */

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

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