Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pN0SX-0008Na-Im for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Jan 2023 23:54:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pN0SU-0003W9-2w for pgsql-hackers@arkaria.postgresql.org; Tue, 31 Jan 2023 23:54:38 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pN0ST-0003Vx-OO for pgsql-hackers@lists.postgresql.org; Tue, 31 Jan 2023 23:54:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pN0SQ-0004be-Mb for pgsql-hackers@lists.postgresql.org; Tue, 31 Jan 2023 23:54:37 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 30VNsVrV1275437; Tue, 31 Jan 2023 18:54:31 -0500 From: Tom Lane To: Aleksander Alekseev cc: PostgreSQL Hackers , Peter Eisentraut Subject: Re: MacOS: xsltproc fails with "warning: failed to load external entity" In-reply-to: <1234349.1675196522@sss.pgh.pa.us> References: <489604.1675095648@sss.pgh.pa.us> <1182c94f-bd43-262c-9452-597ca7d7a742@enterprisedb.com> <1234349.1675196522@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Tue, 31 Jan 2023 15:22:02 -0500" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1275406.1675209235.0@sss.pgh.pa.us> Date: Tue, 31 Jan 2023 18:54:31 -0500 Message-ID: <1275436.1675209271@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1275406.1675209235.1@sss.pgh.pa.us> I wrote: > It's worse than that: I find that > export XML_CATALOG_FILES=/dev/null > breaks the docs build on RHEL8 and Fedora 37 (latest) too, with the > same "failed to load external entity" symptom. I conclude from this > that there is no version of xsltproc anywhere that can still download > the required files automatically. So we need to take out the advice > that says you can rely on auto-download for everybody, not just macOS. > If this is indeed the case, perhaps we ought to start inserting --nonet > into the invocations. There's not much use in allowing these tools to > perform internet access when the best-case scenario is that they fail. Concretely, I'm thinking something like the attached. Notes: 1. I have not tested the meson changes. 2. As this is written, you can't override the --nonet options very easily in the Makefile build (you could do so at runtime by setting XSLTPROC, but not at configure time); and you can't override them at all in the meson build. Given the lack of evidence that it's still useful to allow net access, I'm untroubled by that. I did intentionally skip using "override" in the Makefile, though, to allow that case. 3. For consistency with the directions for other platforms, I made the package lists for macOS just mention libxslt. That should be enough to pull in libxml2 as well. 4. Use of --nonet changes the error message you get if xsltproc can't find the DTDs. I copied the error I get from MacPorts' version of xsltproc, but can you confirm it's the same on Homebrew? regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="force-use-of-nonet-for-docs-build-1.patch"; charset="us-ascii" Content-ID: <1275406.1675209235.2@sss.pgh.pa.us> Content-Description: force-use-of-nonet-for-docs-build-1.patch Content-Transfer-Encoding: quoted-printable diff --git a/doc/src/sgml/Makefile b/doc/src/sgml/Makefile index 4f0e39223c..b96c7cbf22 100644 --- a/doc/src/sgml/Makefile +++ b/doc/src/sgml/Makefile @@ -41,11 +41,15 @@ endif = XMLINCLUDE =3D --path . = -ifndef XMLLINT +ifdef XMLLINT +XMLLINT :=3D $(XMLLINT) --nonet +else XMLLINT =3D $(missing) xmllint endif = -ifndef XSLTPROC +ifdef XSLTPROC +XSLTPROC :=3D $(XSLTPROC) --nonet +else XSLTPROC =3D $(missing) xsltproc endif = diff --git a/doc/src/sgml/docguide.sgml b/doc/src/sgml/docguide.sgml index 787caef70d..cf9d4d4389 100644 --- a/doc/src/sgml/docguide.sgml +++ b/doc/src/sgml/docguide.sgml @@ -151,18 +151,6 @@ here. = - - You can get away with not installing DocBook XML and the DocBook XSLT - stylesheets locally, because the required files will be downloaded fro= m the - Internet and cached locally. This may in fact be the preferred soluti= on if - your operating system packages provide only an old version of these fi= les, - or if no packages are available at all. - If you want to prevent any attempt to access the Internet while buildi= ng - the documentation, you need to pass the optio= n - to xmllint and xsltproc; see bel= ow - for an example. - - Installation on Fedora, RHEL, and Derivatives = @@ -207,22 +195,38 @@ apt-get install docbook-xml docbook-xsl fop libxml2-= utils xsltproc macOS = - - On macOS, you can build the HTML and man documentation without instal= ling - anything extra. If you want to build PDFs or want to install a local= copy - of DocBook, you can get those from your preferred package manager. - - If you use MacPorts, the following will get you set up: -sudo port install docbook-xml-4.5 docbook-xsl fop +sudo port install docbook-xml docbook-xsl-nons fop libxslt If you use Homebrew, use this: -brew install docbook docbook-xsl fop +brew install docbook docbook-xsl fop libxslt + + + The Homebrew-supplied programs require the following environment vari= able + to be set: + +export XML_CATALOG_FILES=3D/usr/local/etc/xml/catalog + + Without it, xsltproc will throw errors like this: + +I/O error : Attempt to load network entity http://www.oasis-open.org/docb= ook/xml/4.5/docbookx.dtd +postgres.sgml:21: warning: failed to load external entity "http://www.oas= is-open.org/docbook/xml/4.5/docbookx.dtd" +... + + + + + While it is possible to use the Apple-provided versions + of xmllint and xsltproc + instead of those from MacPorts or Homebrew, you'll still need + to install the DocBook DTD and stylesheets, and set up a catalog + file that points to them. + = @@ -253,12 +257,6 @@ checking for dbtoepub... dbtoepub these programs, for example ./configure ... XMLLINT=3D/opt/local/bin/xmllint ... - - Also, if you want to ensure that xmllint - and xsltproc will not perform any network access, - you can do something like - -./configure ... XMLLINT=3D"xmllint --nonet" XSLTPROC=3D"xsltproc --nonet"= ... diff --git a/doc/src/sgml/images/Makefile b/doc/src/sgml/images/Makefile index f9e356348b..645519095d 100644 --- a/doc/src/sgml/images/Makefile +++ b/doc/src/sgml/images/Makefile @@ -9,7 +9,7 @@ ALL_IMAGES =3D \ = DITAA =3D ditaa DOT =3D dot -XSLTPROC =3D xsltproc +XSLTPROC =3D xsltproc --nonet = all: $(ALL_IMAGES) = diff --git a/doc/src/sgml/meson.build b/doc/src/sgml/meson.build index b9f4c6a05b..524a4e00e4 100644 --- a/doc/src/sgml/meson.build +++ b/doc/src/sgml/meson.build @@ -87,7 +87,8 @@ postgres_full_xml =3D custom_target('postgres-full.xml', input: 'postgres.sgml', output: 'postgres-full.xml', depfile: 'postgres-full.xml.d', - command: [xmllint, '--noent', '--valid', '--path', '@OUTDIR@', '-o', '@= OUTPUT@', '@INPUT@'], + command: [xmllint, '--nonet', '--noent', '--valid', + '--path', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'], depends: doc_generated, build_by_default: false, ) @@ -100,6 +101,7 @@ alldocs +=3D postgres_full_xml # if xsltproc_bin.found() xsltproc_flags =3D [ + '--nonet', '--stringparam', 'pg.version', pg_version, '--param', 'website.stylesheet', '1' ] ------- =_aaaaaaaaaa0--