Windows: hardlink support is broken on shared drives

Patrick Mézard pmezard at gmail.com
Mon Aug 23 17:35:54 CDT 2010


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.

--
Patrick Mézard


More information about the Mercurial-devel mailing list