michal-h21 / make4ht

Build system for tex4ht
136 stars 15 forks source link

Fatal error due to single quotes around files #68

Closed bleachpuppy closed 2 years ago

bleachpuppy commented 2 years ago

I believe 3bca65f4a1b6d31668c93b48f0d68771f040fd42 broke things, and I can't use make4ht at all anymore.

I'm using MikTex with Windows 10, and make4ht version v0.3k.

Here's my MWE:

File "doc.tex":

\documentclass{report} 
\begin{document}
This is my document.
\end{document}

Command line:

C:\temp\latex>make4ht doc.tex
[STATUS]  make4ht: Conversion started
[STATUS]  make4ht: Input file: doc.tex
[WARNING] tocid: char-def module not found
[WARNING] tocid: cannot fix section id's
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 22.3 Portable) (preloaded format=latex.fmt)
 restricted \write18 enabled.
entering extended mode
[WARNING] htlatex: Make4ht: cannot open log file doc.log
[FATAL]   make4ht-lib: Fatal error. Command htlatex returned exit code 1

Here are the files it made:

C:\temp\latex>dir
 Volume in drive C is OS
 Volume Serial Number is 30B3-1415

 Directory of C:\temp\latex

03/21/2022  03:07 PM    <DIR>          .
03/21/2022  03:07 PM    <DIR>          ..
03/21/2022  03:07 PM                76 'doc'.4tc
03/21/2022  03:07 PM                76 'doc'.aux
03/21/2022  03:07 PM            10,160 'doc'.dvi
03/21/2022  03:07 PM            14,479 'doc'.log
03/21/2022  03:07 PM                21 'doc'.tmp
03/21/2022  03:07 PM                35 'doc'.xref
03/21/2022  03:06 PM                87 doc.tex
               7 File(s)         24,934 bytes
               2 Dir(s)  25,005,801,472 bytes free

So I'm giving it an input file without quotes, but it's adding single quotes to the output file names. As far as I can tell (or guess), the failure looks like it's because subsequent steps within make4ht can't find the intermediate files because they aren't expecting a single quote in the name.

(Side-issue, it'd also be great if the FATAL message would give a better hint as to why did things fail. It doesn't actually show any errors messages that I can see, just warnings. And adding "-a debug" doesn't give any better hints, that I can find at least.)

My previous version (don't know what that was, unfortunately) used to work before updating to the latest version. I haven't tried reverting it but just skimming the recent commits I'd suspect that 3bca65f4a1b6d31668c93b48f0d68771f040fd42 is what broke things.

michal-h21 commented 2 years ago

Thanks for the report. I don't use Windows and Miktex, so I cannot test this behaviour, but I updated mkparams.lua with a escaping function that behaves diferently on Windows and on different operating systems? Could you please try if it fixes the issue? If yes, does it also work for files that have special character in their names? Like hello(world).tex?

michal-h21 commented 2 years ago

I've tested the fix on Mitkex and it seems to work.

bleachpuppy commented 2 years ago

Great, thanks! (Sorry I was offline for a couple days.)

Just tried it and it fixes the issue, and still works for hello[world]_abc(123){456}.tex. Anything else you want me to test?

michal-h21 commented 2 years ago

That's good to hear! I've already pushed the fix to CTAN, as there was code freeze for TeX Live few days ago. I hope that the fix will be included in Miktex soon.