Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Ensure raw binmode when writing archive files in latexmlc #960
This is a platform-specific fix, and in fact I need to double-check this keeps the epub generation as-is on Linux.
It turns out that without an explicit
While debugging, I first verified the archive integrity, all EPUB-needed files were added to the Archive::Zip object and then serialized via IO::String. However, the same payload lead to different
In the end, it turned out the produced archives were partially readable by 7zip (my Win10 archive reader of choice), but were silently corrupted at some hard to predict point in the file-writing process.
Adding an explicit
On 03/19/2018 12:16 PM, Deyan Ginev wrote: It turns out that without an explicit |:raw| binmode, printing out binary data on Windows 10 leads to corrupted archives, for reasons I do not fully understand at the moment.
For unixy systems, files are always just bytes; the binmode only determines a layer which may encode, say Unicode, into bytes. But as I understand it, windows actually distinguishes binary from text files, so binmode for a zip apparently matters.
@brucemiller indeed, that seems to be the case.
I have now added an end-to-end test for epub generation via latexmlc, which runs the executable via the shell, and then checks the resulting file has the expected data integrity and epub contents.
I stumbled on a couple of validator issues while debugging via:
so added some minor upgrades to keep the epub valid.