Windows: hardlink support is broken on shared drives

Patrick Mézard pmezard at gmail.com
Tue Aug 24 03:22:02 CDT 2010


Le 24/08/10 01:09, Adrian Buehlmann a écrit :
> On 24.08.2010 00:44, Adrian Buehlmann wrote:
>> Even simpler. Just specifying 0 for dwDesiredAccess works as well:
>>
>>     def _getfileinfo(pathname):
>>         """Return number of hardlinks for the given file."""
>>         try:
>>             fh = win32file.CreateFile(pathname,
>>                                       0, # device query access
>>                                       win32file.FILE_SHARE_READ,
>>                                       None, win32file.OPEN_EXISTING, 0, None)
>>             try:
>>                 return win32file.GetFileInformationByHandle(fh)
>>             finally:
>>                 fh.Close()
>>         except pywintypes.error, e:
>>             print e
>>             return None
>>
>>
>> [1] has '0' for desiredAccess as (quote):
>>
>>   "Specifies device query access to the object. An application can query device
>>    attributes without accessing the device."
>>
>> [1] http://docs.activestate.com/activepython/2.5/pywin32/win32file__CreateFile_meth.html
> 
> I found 0 for desiredAccess in MSDN documented as [2]:
> 
> "If this parameter is zero, the application can query certain metadata
> such as file, directory, or device attributes without accessing that
> file or device, even if GENERIC_READ access would have been denied. "
> 
> [2] http://msdn.microsoft.com/en-us/library/aa363858%28VS.85%29.aspx

Thanks Adrian, I updated the test script (attached) and rerun the tests. What I am testing is either to get the correct link count [1], or to have serialnum=0 [2]. Here is a new result table:

a -> works
b -> detectable partial
c -> fail
x -> undetectable partial

                    xp   2003  vista   win7
winxp local         a  
winxp rdp                a
win2003 local            a
win2003 share       a    a     a
vista local              a     a
vista share         a    a     
osx via parallels   b
samba               a
netapp

--
Patrick Mézard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testlink.py
Type: text/x-python-script
Size: 1824 bytes
Desc: not available
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20100824/d4d54f8e/attachment.bin>


More information about the Mercurial-devel mailing list