Cygwin CWD vs. Win32 CWD (was Re: [ANNOUNCEMENT] Updated: vim-7.3.003-1)

Corinna Vinschen
Thu Aug 26 08:06:00 GMT 2010

On Aug 26 01:45, Christopher Faylor wrote:
> On Thu, Aug 26, 2010 at 01:35:18AM -0400, Christopher Faylor wrote:
> >On Wed, Aug 25, 2010 at 10:11:23PM -0400, Christopher Faylor wrote:
> >>On Wed, Aug 25, 2010 at 10:45:04PM +0100, Andy Koppe wrote:
> >>>On 25 August 2010 22:09, Christopher Faylor wrote:
> >>>>>cgf, did you get the .o idea to work?
> >>>>
> >>>> It was actually a library but yes. ??I generalized the mechanism to allow
> >>>> -lbinmode -ltextmode, -lautomode to also finally work.
> >>>
> >>>Great! So broken Win32-using programs could be fixed with a rebuild
> >>>with an added build option rather than requiring source changes.
> >>>
> >>>Still got no idea though whether the ability to delete a working
> >>>directory is worth it. As Eric pointed out, POSIX doesn't actually
> >>>require it, but Linux supports it.
> >>
> >>Yeah, that's what I kept vacillating about.  Is it worth the extra overhead
> >>to allow POSIX functionality.  It's Wednesday so I'll go with yes.  I'll
> >>say no on the weekend.
> >
> >Actually, new idea: is there some reason why we don't just cd out of the
> >way when we detect that a deletion of a directory failed?  We could try
> >to set the current working directory in cases where it's possible, only
> >setting it to the pipe location when we actually try to delete it.
> >Wouldn't that pretty much solve the problem?
> Answering my own question: that would only catch the case where one program
> was cd'ed to the location.  If another program also had the directory as
> its current directory then the rmdir would fail.
> But is that an acceptable compromise?

I don't think so.  The common case is that another process is holding
the dir, not the own process.  The generic problem would be that all
Cygwin processes will revert to open CWDs without sharing for deletion.
So the functionality to remove dirs which are CWDs of some process is
spoiled.  Or better, even more spoiled than usual, given that native
Win32 processes are notoriously uncooperative.

AFAICS there is no useful compromise.  If we want the POSIX^WLinux
functionality, we need the extra sync capability from one of our
patches.  Alternatively, if we think the POSIX^WWin32 way is acceptable,
we just use SetCurrentDirectoryW(actual_cwd) and be done with it(*).


(*) Except for dirs invalid as Win32 CWDs which would still use
    \\?\PIPE\, but that would probably have gone without saying.

Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list