Windows: hardlink support is broken on shared drives
Adrian Buehlmann
adrian at cadifra.com
Tue Aug 24 04:24:22 CDT 2010
On 24.08.2010 00:35, Patrick Mézard wrote:
> Le 23/08/10 22:22, Gavin Erry a écrit :
>> All
>>
>>
>>
>> I’ve been reading this thread with interest since I posted the problem on the discussion list. Thanks for the fix – I will test it in the next build of Hg. It seemed strange that GetFileInformationByHandle doesn’t work too well so I had a look (in C++ though)
>>
>>
>>
>> It seems that you can get different results depending on how the handle was created with the CreateFile function.
>>
>> If I use GENERIC_READ or FILE_GENERIC_READ for the desired access in CreateFile then I get an incorrect hardlink count.
>>
>> Using FILE_READ_ATTRIBUTES | SYNCHRONIZE (which is a subset of FILE_GENERIC_READ) then I get the correct hardlink count over the network.
>
> OK, I have seen correct links count returned with FILE_READ_ATTRIBUTES. Do you need the SYNCHRONIZE flag too? I am asking because I first tried without it and it failed then with it alone and it succeeds and now without it, it succeeds again. It's late and I will retry again tomorrow. But I cannot make sense of SYNCHRONIZE in this context.
>
> These flags are really promising, I managed to get the correct link count with all my setups, except when reading through Parallels share, in which case the serial number was zero.
>
> Thanks for this excellent insight.
Bad news.
$ python testlink.py linka
links=1 <--- should be 2
serial=-1898895920
For
Windows 7 x64 (as client) -> Windows 7 x64 (as server)
With
fh = win32file.CreateFile(pathname,
0x0080 | 0x00100000L,
win32file.FILE_SHARE_READ,
None, win32file.OPEN_EXISTING, 0, None)
and with
fh = win32file.CreateFile(pathname,
0,
win32file.FILE_SHARE_READ,
None, win32file.OPEN_EXISTING, 0, None)
More information about the Mercurial-devel
mailing list