This is the mail archive of the cygwin 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: [1.7] Cygwin 1.7 misnames hardlinks


On Wed, 7 Jan 2009, Corinna Vinschen wrote:

The same happens with all hardlinks to files used by the system.  The NT
status code returned when trying to set the delete disposition flag is
C0000121, STATUS_CANNOT_DELETE.  None of the Windows native methods to
delete these hardlinks works.  I'm still puzzeled how to get rid of
them. Does anybody knows how to do that?

On Jan 7 09:38, Brian Ford wrote:
Just a WAG, but disable Windows File Protection?

http://support.microsoft.com/kb/222193

On 090107 08:09, Corinna Vinschen wrote:
No, I found the solution by getting the double-plus surprising result
that removing these hardlinks works in Cygwin 1.5.  For some reason only
the OS hackers at Microsoft might grok, setting the delete dispostion
flag for a file (*) doesn't work, but opening the file with the
FILE_FLAG_DELETE_ON_CLOSE flag and then closing it again (**) works
fine.  Go figure!  Unfortunately the DELETE_ON_CLOSE stuff is too
dangerous in some circumstances so it's not a generic solution.

I'm preparing a fix for 1.7.


Corinna


(*)  Which is also what the Win32 function DeleteFile does.
(**) Which is what Cygwin 1.5 and the native function ZwDeleteFile does.

Thanks for fixing the original hardlink minsnaming problem Corinna.


A Windows native way to remove in-use hardlinks is to overwrite them with DOS Move, e.g.

C:\>ln Windows\fonts\vgaoem.fon .
C:\>del vgaoem.fon
C:\vgaoem.fon
Access is denied.

C:\>echo dummy file> foo
C:\>move /y foo vgaoem.fon >nul
C:\>del vgaoem.fon

A restriction is that the two files foo and vgaoem.fon must reside on the same filesystem (Volume).

New Year Greetings,
Lawrence





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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