Re: MacOS: xsltproc fails with "warning: failed to load external entity"

From: Aleksander Alekseev <aleksander(at)timescale(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: MacOS: xsltproc fails with "warning: failed to load external entity"
Date: 2023-01-31 10:38:44
Message-ID: CAJ7c6TMSsn2r0VLJ6zYM=9TRh5j6JDDSARczFG+wa+BS1A9LWQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

> /opt/local/bin/xsltproc is provided by libxslt, and
> /opt/local/bin/xmllint is provided by libxml2, neither of which
> will be installed by our recipe as given. You might have pulled
> those ports in already to build Postgres with, but if you didn't, the
> recipe will fail. I wonder if the Homebrew recipe has the same bug.

Right, I had libxml2 installed (which provides xmllint) but not
libxslt (which provides xsltproc). For this reason I could find only
the version of xsltproc shipped with macOS.

> Both /usr/bin/xsltproc and /opt/local/bin/xsltproc say
>
> --catalogs : use SGML catalogs from $SGML_CATALOG_FILES
> otherwise XML Catalogs starting from
> file:///etc/xml/catalog are activated by default
>
> However, this appears to be a lie for /opt/local/bin/xsltproc;
> what it's apparently *actually* using is /opt/local/etc/xml/catalog,
> which is what MacPorts provides.

> I repeated the test I did this morning, and this time using --catalogs
> with SGML_CATALOG_FILES set to /opt/local/etc/xml/catalog worked for me,
> using either copy of xsltproc. I must've fat-fingered it somehow before.
> Nonetheless, I doubt that that recipe is worth recommending to MacPorts
> users: if they pull in the DTD packages they might as well pull in libxml2
> and libxslt, and then they don't need to adjust anything.

Got it, thanks.

> In short, I think we need to update J.2.4 to say this for MacPorts:
>
> sudo port install libxml2 libxslt docbook-xml docbook-xsl-nons fop

Agree. I decided to include libxml2 and libxslt for Homebrew as well.
The documentation above explains what these packages are needed for
and also says that some of the packages may be optional. E.g. fop is
actually not strictly required but we recommend installing it anyway.

> But I can't determine right now what catalog file they look at by
> default. It appears that it's neither /etc/xml/catalog nor
> /usr/local/etc/xml/catalog. So in this case, setting XML_CATALOG_FILES
> is necessary.
>
> For either sets of tools, the automatic download option doesn't appear
> to work anymore. This probably has to do with either the https or the
> redirects that have been mentioned.

Peter, thanks for reporting this. I got the same results: neither
tools work without setting XML_CATALOG_FILES and setting this
environment variable work for both Homebrew and macOS versions.

Here is the summary of our findings. PFA the updated patch v2.

While on it, I noticed that the documentation says "On macOS, you can
build the HTML and man documentation without installing anything
extra." I strongly suspect this may not be true anymore. This is
somewhat difficult to check however. Some of the recommended packages
were installed as dependencies of other packages and I don't feel like
taking a risk of running:

```
brew uninstall --ignore-dependencies libxml2 libxslt docbook docbook-xsl
```

... right now. However maybe we should rephrase this to make sure
there are fewer supported/recommended ways of building the
documentation? The alternative ways may also work but if they don't
there will be no actions required from us.

I included the corresponding path as well.

--
Best regards,
Aleksander Alekseev

Attachment Content-Type Size
v2-0001-Update-the-documentation-build-instruction-for-ma.patch application/octet-stream 2.2 KB
v2-0002-Rephrase-the-documentation-build-instruction-for-.patch application/octet-stream 1.6 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message wangw.fnst@fujitsu.com 2023-01-31 10:40:03 RE: [PATCH] Reuse Workers and Replication Slots during Logical Replication
Previous Message wangw.fnst@fujitsu.com 2023-01-31 10:27:26 RE: [PATCH] Reuse Workers and Replication Slots during Logical Replication