commit: e2ad39711358747cfae95a6751021d62971315bc Author: Thomas Bracht Laumann Jespersen <t <AT> laumann <DOT> xyz> AuthorDate: Thu Nov 13 20:12:06 2025 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Nov 16 10:31:55 2025 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e2ad3971
app-text/xmlstarlet: fix val mode reading from stdin For --embed and other flags for "xmlstarlet val", the xmlReaderForFile() and xmlReaderNewFile() functions do not work with stdin. Instead match on '-' as the filename and switch to xmlReaderForFd() and xmlReaderNewFd() respectively. This makes all the tests pass again. Closes: https://bugs.gentoo.org/944765 Signed-off-by: Thomas Bracht Laumann Jespersen <t <AT> laumann.xyz> Part-of: https://github.com/gentoo/gentoo/pull/44621 Signed-off-by: Sam James <sam <AT> gentoo.org> .../xmlstarlet-1.6.1-libxml2-2.13-stdin.patch | 46 ++++++++++++++++ app-text/xmlstarlet/xmlstarlet-1.6.1-r5.ebuild | 62 ++++++++++++++++++++++ 2 files changed, 108 insertions(+) diff --git a/app-text/xmlstarlet/files/xmlstarlet-1.6.1-libxml2-2.13-stdin.patch b/app-text/xmlstarlet/files/xmlstarlet-1.6.1-libxml2-2.13-stdin.patch new file mode 100644 index 000000000000..ec55973597ac --- /dev/null +++ b/app-text/xmlstarlet/files/xmlstarlet-1.6.1-libxml2-2.13-stdin.patch @@ -0,0 +1,46 @@ +see https://bugs.gentoo.org/944765 +--- a/src/xml_validate.c ++++ b/src/xml_validate.c +@@ -28,6 +28,7 @@ THE SOFTWARE. + + #include <config.h> + ++#include <unistd.h> + #include <string.h> + #include <stdio.h> + #include <stdlib.h> +@@ -408,15 +409,31 @@ valMain(int argc, char **argv) + for (i=start; i<argc; i++) + { + int failed = 0; ++ int is_stdin = argv[i][0] == '-' && argv[i][1] == 0; ++ + if (ops.embed) options |= XML_PARSE_DTDVALID; + + if (!reader) + { +- reader = xmlReaderForFile(argv[i], NULL, options); ++ if (is_stdin) ++ { ++ reader = xmlReaderForFd(STDIN_FILENO, argv[i], NULL, options); ++ } ++ else ++ { ++ reader = xmlReaderForFile(argv[i], NULL, options); ++ } + } + else + { +- failed = xmlReaderNewFile(reader, argv[i], NULL, options); ++ if (is_stdin) ++ { ++ failed = xmlReaderNewFd(reader, STDIN_FILENO, argv[i], NULL, options); ++ } ++ else ++ { ++ failed = xmlReaderNewFile(reader, argv[i], NULL, options); ++ } + } + + errorInfo.xmlReader = reader; + diff --git a/app-text/xmlstarlet/xmlstarlet-1.6.1-r5.ebuild b/app-text/xmlstarlet/xmlstarlet-1.6.1-r5.ebuild new file mode 100644 index 000000000000..31cf3767377a --- /dev/null +++ b/app-text/xmlstarlet/xmlstarlet-1.6.1-r5.ebuild @@ -0,0 +1,62 @@ +# Copyright 1999-2025 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools flag-o-matic toolchain-funcs + +DESCRIPTION="A set of tools to transform, query, validate, and edit XML documents" +HOMEPAGE="https://xmlstar.sourceforge.net/" +SRC_URI="https://downloads.sourceforge.net/xmlstar/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ppc ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos" + +RDEPEND=" + dev-libs/libxml2:= + dev-libs/libxslt + dev-libs/libgcrypt:0= + virtual/libiconv" +DEPEND="${RDEPEND}" +BDEPEND="virtual/pkgconfig" + +PATCHES=( + "${FILESDIR}"/${PN}-1.6.1-clang16.patch + "${FILESDIR}"/${PN}-1.6.1-clang17.patch + "${FILESDIR}"/${PN}-1.6.1-libxml2-2.14.0-compile.patch + "${FILESDIR}"/${PN}-1.6.1-libxml2-2.13-stdin.patch +) + +src_prepare() { + default + + # We need to patch use of /usr/lib because it is a problem with + # linker lld with profile 17.1 on amd64 (see https://bugs.gentoo.org/729600). + # The grep sandwich acts as a regression test so that a future + # version bump cannot break patching without noticing. + if [[ $(get_libdir) != lib ]]; then + grep -wq _PREFIX/lib m4/xstar-check-libs.m4 || die + sed "s,_PREFIX/lib,_PREFIX/$(get_libdir)," -i m4/xstar-check-libs.m4 || die + grep -w _PREFIX/lib m4/xstar-check-libs.m4 && die + fi + + eautoreconf +} + +src_configure() { + append-cppflags $($(tc-getPKG_CONFIG) --cflags libxml-2.0) + + # NOTE: Fully built documentation is already shipped with the tarball: + # - doc/xmlstarlet-ug.{pdf,ps,html} + # - doc/xmlstarlet.txt + # - doc/xmlstarlet.1 + econf \ + --disable-build-docs \ + --disable-static-libs +} + +src_install() { + default + dosym xml /usr/bin/xmlstarlet +}
