From c879317c75135c0fc041b6e629f5abceda8c9b48 Mon Sep 17 00:00:00 2001 From: David King Date: Mon, 26 Jan 2026 15:00:45 +0000 Subject: [PATCH] Fix xmllint error code (RHEL-126768) Resolves: RHEL-126768 --- libxml2-2.12.5-xmllint-error-code.patch | 88 +++++++++++++++++++++++++ libxml2.spec | 7 +- 2 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 libxml2-2.12.5-xmllint-error-code.patch diff --git a/libxml2-2.12.5-xmllint-error-code.patch b/libxml2-2.12.5-xmllint-error-code.patch new file mode 100644 index 0000000..bbefeda --- /dev/null +++ b/libxml2-2.12.5-xmllint-error-code.patch @@ -0,0 +1,88 @@ +From 387a952bdb7a4364100f009043e94e1bf44c6197 Mon Sep 17 00:00:00 2001 +From: Nick Wellnhofer +Date: Mon, 12 Feb 2024 16:45:16 +0100 +Subject: [PATCH] xmllint: Return error code if XPath returns empty nodeset + +Return an error code as before but make it possible to distinguish from +real errors. + +Fixes #690. +--- + doc/xmllint.xml | 11 ++++++++++- + xmllint.c | 24 +++++++++++++----------- + 2 files changed, 23 insertions(+), 12 deletions(-) + +diff --git a/doc/xmllint.xml b/doc/xmllint.xml +index b81da3aa7..8bc665216 100644 +--- a/doc/xmllint.xml ++++ b/doc/xmllint.xml +@@ -575,7 +575,9 @@ + result. In case of a nodeset result, each node in the + node set is serialized in full in the output. In case + of an empty node set the "XPath set is empty" result +- will be shown and an error exit code will be returned. ++ will be shown and exit code 11 will be returned.. ++ This feature is EXPERIMENTAL. Implementation details can ++ change without futher notice. + + + +@@ -945,6 +947,13 @@ + + + ++ ++ 11 ++ ++ XPath result is empty ++ ++ ++ + + + +diff --git a/xmllint.c b/xmllint.c +index 21dbe7d24..5c26c3fe8 100644 +--- a/xmllint.c ++++ b/xmllint.c +@@ -86,17 +86,18 @@ + #endif + + typedef enum { +- XMLLINT_RETURN_OK = 0, /* No error */ +- XMLLINT_ERR_UNCLASS = 1, /* Unclassified */ +- XMLLINT_ERR_DTD = 2, /* Error in DTD */ +- XMLLINT_ERR_VALID = 3, /* Validation error */ +- XMLLINT_ERR_RDFILE = 4, /* CtxtReadFile error */ +- XMLLINT_ERR_SCHEMACOMP = 5, /* Schema compilation */ +- XMLLINT_ERR_OUT = 6, /* Error writing output */ +- XMLLINT_ERR_SCHEMAPAT = 7, /* Error in schema pattern */ +- XMLLINT_ERR_RDREGIS = 8, /* Error in Reader registration */ +- XMLLINT_ERR_MEM = 9, /* Out of memory error */ +- XMLLINT_ERR_XPATH = 10 /* XPath evaluation error */ ++ XMLLINT_RETURN_OK = 0, /* No error */ ++ XMLLINT_ERR_UNCLASS = 1, /* Unclassified */ ++ XMLLINT_ERR_DTD = 2, /* Error in DTD */ ++ XMLLINT_ERR_VALID = 3, /* Validation error */ ++ XMLLINT_ERR_RDFILE = 4, /* CtxtReadFile error */ ++ XMLLINT_ERR_SCHEMACOMP = 5, /* Schema compilation */ ++ XMLLINT_ERR_OUT = 6, /* Error writing output */ ++ XMLLINT_ERR_SCHEMAPAT = 7, /* Error in schema pattern */ ++ XMLLINT_ERR_RDREGIS = 8, /* Error in Reader registration */ ++ XMLLINT_ERR_MEM = 9, /* Out of memory error */ ++ XMLLINT_ERR_XPATH = 10, /* XPath evaluation error */ ++ XMLLINT_ERR_XPATH_EMPTY = 11 /* XPath result is empty */ + } xmllintReturnCode; + #ifdef LIBXML_DEBUG_ENABLED + static int shell = 0; +@@ -2019,6 +2020,7 @@ static void doXPathDump(xmlXPathObjectPtr cur) { + xmlOutputBufferPtr buf; + + if ((cur->nodesetval == NULL) || (cur->nodesetval->nodeNr <= 0)) { ++ progresult = XMLLINT_ERR_XPATH_EMPTY; + if (!quiet) { + fprintf(stderr, "XPath set is empty\n"); + } +-- +GitLab + diff --git a/libxml2.spec b/libxml2.spec index a2981fb..b590f2d 100644 --- a/libxml2.spec +++ b/libxml2.spec @@ -1,6 +1,6 @@ Name: libxml2 Version: 2.12.5 -Release: 9%{?dist} +Release: 10%{?dist} Summary: Library providing XML and HTML support # list.c, dict.c and few others use ISC-Veillard @@ -37,6 +37,8 @@ Patch8: libxml2-2.12.5-CVE-2025-7425.patch Patch9: libxml2-2.12.5-CVE-2025-32415.patch # https://issues.redhat.com/browse/RHEL-99861 Patch10: libxml2-2.12.5-CVE-2025-32414.patch +# https://issues.redhat.com/browse/RHEL-126768 +Patch11: libxml2-2.12.5-xmllint-error-code.patch BuildRequires: cmake-rpm-macros BuildRequires: gcc @@ -177,6 +179,9 @@ popd %{python3_sitelib}/__pycache__/drv_libxml2.* %changelog +* Mon Jan 26 2026 David King - 2.12.5-10 +- Fix xmllint error code (RHEL-126768) + * Tue Aug 05 2025 David King - 2.12.5-9 - Fix CVE-2025-32415 (RHEL-100174) - Fix CVE-2025-32414 (RHEL-99861)