After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 790746 - Allow xmlcatalog to search in XML_CATALOG_FILES
Allow xmlcatalog to search in XML_CATALOG_FILES
Status: RESOLVED FIXED
Product: libxml2
Classification: Platform
Component: catalog
git master
Other Linux
: Normal normal
: ---
Assigned To: Daniel Veillard
Depends on:
Blocks:
 
 
Reported: 2017-11-23 02:20 UTC by Jan Tojnar
Modified: 2017-11-23 04:27 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Jan Tojnar 2017-11-23 02:20:58 UTC
On NixOS, there is no central catalog file, we rely entirely on XML_CATALOG_FILES variable which is populated by dependencies inside the package scope. For example, if a package depends on XHTML 1.0 and SVG 1.1, the variable will be set as follows:

$ echo $XML_CATALOG_FILES
/nix/store/gpmc5rrkcb5w4624kijqinva2iaqpd3y-xhtml1-20020801/xml/dtd/xhtml1/catalog.xml /nix/store/hcgy8rw0wa20pwrmybqn7lvmzyz1li4s-svg-1.1/share/xml/svg-1.1/catalog.xml

Now if we want to check if a schema is available, we need to run the command for every item listed in the variable – we cannot just omit the catalog path:

$ xmlcatalog "-//W3C//DTD XHTML 1.0 Strict//EN"
Unknown option -//W3C//DTD XHTML 1.0 Strict//EN
$ xmlcatalog -- "-//W3C//DTD XHTML 1.0 Strict//EN"
Unknown option --
$ xmlcatalog "" "-//W3C//DTD XHTML 1.0 Strict//EN"
No entry for PUBLIC -//W3C//DTD XHTML 1.0 Strict//EN

It works correctly in the shell, but that is hardly usable from scripts:

$ xmlcatalog --shell
> public "-//W3C//DTD XHTML 1.0 Strict//EN"
/nix/store/gpmc5rrkcb5w4624kijqinva2iaqpd3y-xhtml1-20020801/xml/dtd/xhtml1/xhtml1-strict.dtd


Optimally, the command would allow to omit the CATALOGFILE argument but since the entities parameter is variadic, we need to introduce a placeholder or a new option. I propose a --lookup option, that would skip the CATALOGFILE requirement.
Comment 1 Jan Tojnar 2017-11-23 02:25:22 UTC
Forgot to mention, in the absence of XML_CATALOG_FILES variable, the default /etc/xml/catalog catalog would be searched, as described on the manpage.
Comment 2 Jan Tojnar 2017-11-23 04:27:43 UTC
I was using libxml 2.9.5, apparently this was fixed in 2.9.7. Good work!