Hello!
It has come to my attention that file l10n-set.xml of docbook2X contains an invalid re-declaration of predefined XML entity lt that it then references as < further down to include the content of file lt.xml to translate terms to Lithuanian language:
# grep -n -C1 lt /usr/share/docbook2X/xslt/common/text/l10n-set.xml
23-<!ENTITY ko SYSTEM "ko.xml">
24:<!ENTITY lt SYSTEM "lt.xml">
25-<!ENTITY nl SYSTEM "nl.xml">
--
67-&ko;
68:<
69-&nl;
# grep -n 'language-name' /usr/share/docbook2X/xslt/common/text/lt.xml
8: <l:english-language-name>Lithuanian</l:english-language-name>
The XML 1.0r4 specification (www.w3.org) is is clear in section 4.6 Predefined Entities that this is invalid, saying:
If the entities
ltorampare declared, they MUST be declared as internal entities whose replacement text is a character reference to the respective character (less-than sign or ampersand) being escaped; the double escaping is REQUIRED for these entities so that references to them produce a well-formed result.
As a result of this violation, every call to docbook2x-man makes libxml2 rightfully complain about this with a warning: here's a reproducer to see this in action:
# cd "$(mktemp -d)"
# git clone --depth 1 https://github.com/libexpat/libexpat
# docbook2x-man --version | head -n2
/usr/bin/docbook2x-man (part of docbook2X 0.8.8)
$Revision: 1.12 $ $Date: 2006/04/14 17:29:04 $
# docbook2x-man libexpat/expat/doc/xmlwf.xml
/usr/share/docbook2X/xslt/common/text/l10n-set.xml:24: parser warning : Invalid redeclaration of predefined entity 'lt'
<!ENTITY lt SYSTEM "lt.xml">
^
Or for a reproducer with nothing but xmllint:
# xmllint - <<<'<!DOCTYPE d [<!ENTITY lt "invalid">]><d/>'
-:1: parser warning : Invalid redeclaration of predefined entity 'lt'
<!DOCTYPE d [<!ENTITY lt "invalid">]><d/>
^
<?xml version="1.0"?>
<!DOCTYPE d>
<d/>
Please consider applying the patch attached. Thank you!
Best, Sebastian
PS: Here's a version of the patch with the file path adjusted to fit GNU/Linux distros out of the box. Gentoo now has that patch applied to its package
app-text/docbook2X.Thanks; this resolved all the
'error : xmlAddEntity: invalid redeclaration of predefined entity'I was seeing building the documentation of git. Applied to thedocbook2xpackage in GNU Guix.