[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#993678: Fails to produce PDF output when using scale.by.width - produces broken lstlisting/lstcode options



Package: dblatex
Version: 0.3.12py3-1
Severity: important

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

While building a PDF we stumbled upon an issue. Some of our XML files contain
screen elements with non UTF-8 characters. When we enable scaling for listing
elements:

<xsl:param name="literal.extensions">scale.by.width</xsl:param>

dblatex fails. The produced .tex files then contain line such as:

\begin{lstcode}[escapeinside={<:}{:>}][scale=false,firstnumber=1,escapeinside={<t>}{</t>},moredelim={**[is][\bfseries]{<b>}{</b>}},moredelim={**[is][\itshape]{<i>}{</i>}},]

and those lead to a failure. The problem seems to be code in

/usr/lib/python3/dist-packages/dbtexmf/dblatex/rawverb.py

which fails to detect existing options (added via
/usr/share/xml/docbook/stylesheet/dblatex/xsl/verbatim.xsl already). Thus
dblatex adds another set of options. The same happens without using
scale.by.width, but the resulting lstlisting elements just produce a warning,
that the second set of options gets dropped.

There are several issues I was able to locate. In parse_begin()

if line[0] == b"[":

doesn't seem to work (here they check for existing options). And after fixing
that, the next issue is that

e = line.find(b"]")+1

will fail to produce the desired result because

[scale=false,firstnumber=1,escapeinside={<t>}{</t>},moredelim={**[is][\bfseries]{<b>}{</b>}},moredelim={**[is][\itshape]{<i>}{</i>}},]

contains several closing brackets and we need to find the matching one. Maybe
one could search for ',]'? Not sure if this will break dblatex in other ways.

Next issue then is:

Error: utf_8_encode() argument 2 must be str or None, not bytes

The problem here seems to be in
/usr/lib/python3/dist-packages/dbtexmf/dblatex/rawparse.py and a change in
Python 3 related to string handling.

This problem is a show stopper for us at the moment. Any help is greatly
appreciated.

Attached is a simple testcase. Use it via:

dblatex -d -D -b xetex -p config.xsl test.xml

Regards, Daniel

- -- System Information:
Debian Release: bookworm/sid
  APT prefers stable-security
  APT policy: (500, 'stable-security'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages dblatex depends on:
ii  docbook-xml           4.5-9
ii  python3               3.9.2-3
ii  python3-apt           2.2.1
ii  texlive               2020.20210202-3
ii  texlive-bibtex-extra  2020.20210202-3
ii  texlive-extra-utils   2020.20210202-3
ii  texlive-latex-extra   2020.20210202-3
ii  texlive-science       2020.20210202-3
ii  xsltproc              1.1.34-4

Versions of packages dblatex recommends:
pn  dblatex-doc    <none>
ii  libxml2-utils  2.9.12+dfsg-3

Versions of packages dblatex suggests:
pn  docbook                          <none>
ii  evince [pdf-viewer]              40.4-2
ii  fig2dev [transfig]               1:3.2.8b-1
ii  ghostscript                      9.53.3~dfsg-7+b1
ii  imagemagick                      8:6.9.11.60+dfsg-1.3
ii  imagemagick-6.q16 [imagemagick]  8:6.9.11.60+dfsg-1.3
ii  inkscape                         1.0.2-4
pn  latex-cjk-all                    <none>
ii  lmodern                          2.004.5-6.1
pn  opensp                           <none>
pn  texlive-lang-all                 <none>
ii  texlive-lang-cyrillic            2020.20210202-2
ii  texlive-xetex                    2020.20210202-3
pn  xindy                            <none>

- -- no debconf information

- -- debsums errors found:
debsums: changed file /usr/lib/python3/dist-packages/dbtexmf/dblatex/rawparse.py (from dblatex package)
debsums: changed file /usr/lib/python3/dist-packages/dbtexmf/dblatex/rawverb.py (from dblatex package)

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEvu1N7VVEpMA+KD3HS80FZ8KW0F0FAmEzrtwACgkQS80FZ8KW
0F2BxQ//WYw7oaVEBsyv3OTulI7w3Ji5UYiE94bRV6CTS1u20KnCk1NSt0OXZFZD
YaIJP0LIphiXctERIH+smTf/8Earn65ypI1WJA5uvBMNPLyV4pJlKIBzHTuCvMLp
OuobH9S5sUdGYkevx8th7zfzsa84S5jgsQlzoigHxM4nQUVXT4VOf3NvEGtC2vsm
qaJx/cyId+Ly8lGZdZfEapmfUr9mSA8B3tQdxSNDDOSZi32VNFgnfF6mYZLHvrTW
kgonjRYA1DrALjTOCd5TmhzC8MaEH2bVKctT6qVGDgBLRRxbmxx05KjhdT4YRJcs
gUZ1QV807Xj9ygnXGTqJGGRMgAGm7HsRn8aeSOpJ51g3UW4xji0oqxjJH5WTnIsX
2es27wntyQJTEo01AmCL5I3KQ7zc9EN8Se64HDTTqVaIrQEoak4V+8e5SI8ydNB2
y11nGmEhmU2ELA8x5ZH5NwgbvBg5zEsMAExy09SjgN3PtIi8xh2fCQ4GAnaXARKc
01kLcKPN/O2X6t+J9ZyezktOPXygVIjlDn4M6AmrQpjvHvzqwxHrOPpwgWEhvb7O
0TljZybgSpfWA78FVAGP7OCS2aDUaPX4YnhFNwjxm0kFyubJMgrsG8vKfLlpWB+Z
C2OAH3ltk0bLeAYT04ckC3Pm0CaBdpsWw8MsZw+49nWTMoW4inI=
=RCP5
-----END PGP SIGNATURE-----
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.5//EN"
  "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd";>
<book lang="en-US">
<chapter>
<title>Chapter</title>
<para>Test</para>
<section>
<title>Section</title>
<para>Test</para>
<screen><computeroutput>$ </computeroutput><userinput>ls travail/</userinput>
<computeroutput>Ic�nes  �l�ments graphiques  Textes</computeroutput>
</screen>
</section>
</chapter>
</book>
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                xmlns:m="http://www.w3.org/1998/Math/MathML";
                version="1.0">

<!-- Support scaling of listings -->
<xsl:param name="literal.extensions">scale.by.width</xsl:param>

</xsl:stylesheet>

Reply to: