[Tex/LaTex] Why does Error 256 (driver return code) yield an exit status of 0 (return code 0)

errorslinuxunixxetex

I may have discovered a problem with xelatex. Unfortunately, I do not know how to reproduce Error 256 easily. What I know is that it occurs when running an automated script that iterates over many TeX files, and not when I process a specific file. The dubious nature of this problem makes it difficult for me to identify conditions which cause the problem. Actually, I am not interested in solving the problem here anyway. What strikes me as odd is that my script is designed to detect error codes (if return code is not 0, then identify that junk and tell me).

The process call is

/usr/local/texlive/2016/bin/x86_64-linux/xelatex -interaction=nonstopmode -halt-on-error -file-line-error DVDCover.tex

which should return and yield a non-zero at any sign of trouble–this would be the expected behavior of normal Unix binaries.

So more frightening than the problem itself is that xelatex returns with 0 as if all were good. The last couple lines in the log read as follows:

Error 256 (driver return code) generating output;
file DVDCover.pdf may not be valid.

Notes

Best Answer

To get this from the unanswered list.

When xdvipdfmx fails one gets error code 1 (from xdvipdfmx) if one calls first xelatex --no-pdf and then xdvipdfmx file.xdv.

In the "combined" compilation xelatex file xetex obviously does check the exit code of xdvipdfmx, after all it adds a message to the log and the terminal. But currently it doesn't change its own status if the driver exists with 1.

This has been discussed on the xetex site: https://sourceforge.net/p/xetex/bugs/140/. This bug has been resolved future versions will exit with status 1 when the driver fails.