Subject: bug#65628: Document preview fails with long filenames

From: John Holman <[email-masked]>
Date: Wed, 30 Aug 2023 18:52:04 +0100

Have to say this explanation seems unlikely to me at first sight. File path
limit MAX_PATH is 260 but here we have
C:\Users\johng\temp\textest\01234567890123456789012.tex which is only
about 50. Routinely deal with much longer paths than this using windows
without a problem. Similarly max command length for cmd.exe is 8182, the
underlying API limit is 32767 - and you can see the full command to
pdflatex echoed in the log so it's obviously getting through - so that also
seems unlikely.

On Wed, 30 Aug 2023 at 18:35, David Kastrup <[email-masked]> wrote:

> John Holman <[email-masked]> writes:
>
> > Hi. I'm not sure that the problem was captured in the log below created
> > by preview-report-bug so a few more details first:
> >
> > Running auctex on windows 11 with MiKTeX
> >
> > Test file contents (but most files containing maths seem to trigger the
> > problem)
> >
> > \documentclass{article}
> > \begin{document}
> >
> > \(x=y\)
> >
> > \end{document}
> >
> > Document preview works when the filename has no more than 22 characters,
> > e.g. test.tex, but fails with message "Ghostscript filter: No bounding
> box"
> > when the filename has more, e.g. 01234567890123456789012.tex. However
> > buffer preview always works.
> >
> > When document preview fails the maths sections are replaced with the
> > roadworks signs indefinitely. The 01234567890123456789012.prv directory
> is
> > created
> > containing a temp folder containing a preview.dsc file but no png
> > images. The rungs.exe and mgs.exe processes don't exit until killed
> manually
> > or emacs is closed.
> >
> > The contents of the *.. output* buffer are then
> >
> > Running `Preview-LaTeX' on `012345678901234546789012' with ``pdflatex
> >  -file-line-error
> >
> "\nonstopmode\nofiles\PassOptionsToPackage{active,tightpage,auctex}{preview}\AtBeginDocument{\ifx\ifPreview\undefined\RequirePackage[displaymath,floats,graphics,textmath,sections,footnotes]{preview}[2004/11/05]\fi}"
> > "\input" "\detokenize{" "012345678901234546789012.tex" "}"''
>
> Probably exceeding a total command line length of 256 characters or some
> similar Windows restriction.  I also seem to remember that some Windows
> file system or API limited the length of absolute filenames you could
> access even when only using relative filenames, so the length of the
> directory path you are in might also play a part here.
>
> --
> David Kastrup
>