[tlbuild] dvisvgm scaling error

Christophe Baribaud baribaud.christophe at wanadoo.fr
Sun Apr 17 17:48:43 CEST 2016


I encountered a strange error on a beaglebone black (arm architecture)
with a "linux from scratch" and the current "beyond linux from scratch"

Hardware: Beaglebone Black
CPU: ARM v7
Linux Kernel: 4.1.10
gcc: 4.8.3
TexLive: 2015


The following command:

dvisvgm --no-fonts --scale=1.4 --exact -o essai.svg essai.dvi

generates the error:

ERROR: expression syntax error

The error is linked to the "--scale" option, or any of the transformation
options (translate, rotate)

After digging into the code, I found that the function getArgument in
the source file texk/dvisvgm/dvisvgm-1.9.2/src/Matrix.cpp adds an extra
character -1 at the end of the argument. The argument is "1.4?" instead
of "1.4" and the calculator refuses it.

I applied the following patch to fix the issue:


--- Matrix_old.cpp      2015-03-02 09:48:21.000000000 +0100
+++ Matrix.cpp  2016-04-17 13:13:59.387206793 +0200
@@ -341,7 +341,7 @@
                optional = false; // now we expect a parameter
        }
        string expr;
-       while (is && !isupper(is.peek()) && is.peek() != ',')
+       while (is && !isupper(is.peek()) && is.peek() != ',' && is)
                expr += (char)is.get();
        if (expr.length() == 0) {
                if (optional)


The idea is to check that the peek method hasn't reach the end of file
condition before using its return value, which whould be -1.

The current code seem to rely on the fact that isupper(-1) is true. It
is not the case in my configuration (should it be ?)

Regards
Christophe Baribaud



More information about the tlbuild mailing list