NTFS and hardlinks

Matt Harbison mharbison72 at gmail.com
Fri Dec 22 22:39:25 UTC 2017


I forgot about this, but e506e461c7a9 disabled hardlinks unless the  
filesystem is in a whitelist.  NTFS isn't in that list, and Windows  
doesn't implement osutil.getfstype().  I thought the issue was only CIFS  
(see issue4546).  It looks like it's just a matter of calling  
GetVolumeNamePath(), GetVolumeInformation(), and doing the bytes -> wide  
char dance.  (Are we assuming the path bytes are UTF-8?)  Is there an  
issue here I'm not aware of, or is this doable?

The reason I ask is I just stumbled upon util.copyfile(), which holds this  
whitelist.  lfutil.link() doesn't know anything about the whitelist, and  
will happily create hardlinks anywhere.  I tried having lfutil.link() call  
util.copyfile(), but that broke several lfs and largefile tests.  They  
should be conditionalized, but I'd rather not lose the ability to run  
these tests on Windows.  (Most of the lfs verification stuff I submitted  
yesterday doesn't get a corrupt file to choke on when full copies are  
done.)


More information about the Mercurial-devel mailing list