This is the mail archive of the cygwin-developers@cygwin.com 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]

[Pierre.Humblet@ieee.org: Re: cygwin-1.5.4-1 breaks fetchmail on Win9x (Pierre can you comment?)]


----- Forwarded message from "Pierre A. Humblet" <Pierre.Humblet@ieee.org> -----
> Hmm, I remember investigating what's happening when a Win9X mounts a
> file system on NT and there are hard links..
> 
> This is what I see on Win98/Me:
> - DELETE_ON_CLOSE works if the file is not yet opened.
> - If it is opened for writing, CreateFile (DELETE_ON_CLOSE) fails and the
>   file is eventually put on the delete queue, at least if it is local.
>   Why not if it's remote?
> - However if the file is opened for reading, then CreateFile (DELETE_ON_CLOSE)
>   succeeds, CloseHandle returns 1, but the file is not deleted.
>   That's the case that Mark Ord examined. It's an MS bug, the documentation
>   states that CreateFile should fail.
> 
> So there is indeed a current problem. Until the next Cygwin release fetchmail
> could possibly patch things up by opening the file for writing. 
----- End forwarded message -----

Following an old tradition, I moved the discussion to cygwin-developers.

I tried it this morning and, surprise, the small example actually
doesn't work on my 98 VM so it turns out that DELETE_ON_CLOSE somehow
doesn't do on 98 what it seems to be designed for.

I searched the Microsoft KB for FILE_FLAG_DELETE_ON_CLOSE but it does
not talk about such a problem, except for two very specific problems
in NT 3.51.

However, the flag seems to be limited in it's effect.  From the spare
information in MSDN, it seems the flag only works in 9x, if the file
has been *created* using that flag.  Opening it at a later point and from
somewhere else just doesn't do what it should.  I also changed the
testcase so that the file is opened for writing and for reading/writing
with the result, that the file gets deleted... but by an entry into
delqueue, not by the CreateFile(FILE_FLAG_DELETE_ON_CLOSE), which just
fails then.  Even though that's annoying, it matches the descriptions
of that flag in MSDN.

So, the problem here is, that CreateFile(FILE_FLAG_DELETE_ON_CLOSE)
does not fail, if the application has opened the file only for
reading.  Other than that, that method simply doesn't work at all on 9x.
Since we have already noticed that at one point, the
"has_delete_on_close" flag in wincap.cc is set to false for all 9x
OSes.  We just have to use it in unlink() to skip that part of the
code.  I've checked in a (hopefully appropriate) patch.

Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Developer                                mailto:cygwin@cygwin.com
Red Hat, Inc.


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