Mangled file names in temp dir

Pavel Sanda sanda at lyx.org
Mon Oct 23 23:32:03 UTC 2023


On Mon, Oct 23, 2023 at 11:30:44PM +0200, Enrico Forestieri wrote:
> >There is one point I'm not sure about - is it really true that windows still
> >set default limit for max path length to ~260 chars?
> 
> Yes, the APIs are still limited to that length:
> 
> $ grep MAX_PATH /usr/include/w32api/minwindef.h
> #define MAX_PATH 260

That's bad news.

> >If so it might be good use shorter hash for windows. I previously used sha-256
> >resulting in +65 chars, but we could swicth to sha-1 (41 chars) or turn it off
> >altogether for windows. Any opinion about that?
> 
> I suggest to simply using a counter also in the html export case and forget
> about encrypted paths. I mean, simply use a progressive number and name of
> file.

There is a reason I dropped the counter for xhtml. Unlike latex export the
mangled names are used in final export directory. Unfortunately the counter
numbers can be completely different across different LyX sessions. Different
ordering of opened files or editing the file itself will change them. So
if you export couple of times there is increasing number of forgotten mangled
images in the export directory and it quickly becomes mess (tested).

Using hash solves this as the mangled filename becomes more stable.
As pathway length is an issue on the windows the easy solution of using
just sha-256 seems to be no go now. 

So my current idea is just to use way shorter MD5 and handle collisions
gracefully. Will try to come up with new patch.

Pavel


More information about the lyx-devel mailing list