sisong / HDiffPatch

a C\C++ library and command-line tools for Diff & Patch between binary files or directories(folder); cross-platform; runs fast; create small delta/differential; support large files and limit memory requires when diff & patch.
Other
1.52k stars 280 forks source link

hdiffz fail with long path file #363

Closed florian-gandon closed 10 months ago

florian-gandon commented 10 months ago

Hello !

I've the following error when generating a patch file.

call import system api error! errno: 2, errmsg: No such file or directory. dir diff run an error: open file "c:#################################################################################################################################################################################################################################################################" error! ERROR!

(I've replaced the path for privacy reason.) The path is 261 characters long for one of the file in the folder. It is working when it is shorter. I think less or equal to 256.

Is it a know issue ? Is there a way to avoid such except reducing the path ?

sisong commented 10 months ago

What OS are you running on?

now, the maximum length of file path supported by hpatchz is 2KB.

florian-gandon commented 10 months ago

Hi !

I forgot to mention. It is Windows 10. I'm using the windows64 version. I guess this is the well known Windows issue when length is more than 260 characters. I thought it was supposed to be fixed in newer versions especially the 64bits one. I've checked the Windows Registry. It is supposed to be activated. Also, I tried with relative path but I've the same issue.

I'm not actually sure we can fix it in Hdiff.

Regards, Florian

florian-gandon commented 10 months ago

I'm not that of an expert in C or C++ but it seems there are solutions like the one described there. Not sure how easy it is to implement for Hdiff.

sisong commented 10 months ago

Thank you for your new info, I've fixed this issue, and a new version will be released soon.

florian-gandon commented 10 months ago

Thank you ! I see only the version upgrade linked to this issue. I would be interested to know how it was fixed.

sisong commented 10 months ago

@florian-gandon need re download cmdline from https://github.com/sisong/HDiffPatch/releases
fix by add a manifest file to exe vc-project, see: https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

florian-gandon commented 10 months ago

Thank you for the quick fix ! It is working perfectly.