=== Applying patches on top of PostgreSQL commit ID 144ad723a4484927266a316d1c9550d56745ff67 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sat Jul 5 23:47:21 UTC 2025 On branch cf/5718 nothing to commit, working tree clean === using 'git am' to apply patch ./v3-0001-contrib-xml2-xslt_process-now-reports-XSLT-relate.patch === Applying: contrib/xml2: xslt_process() now reports XSLT-related error details Using index info to reconstruct a base tree... M contrib/xml2/xslt_proc.c M src/backend/utils/adt/xml.c Falling back to patching base and 3-way merge... Auto-merging src/backend/utils/adt/xml.c Auto-merging contrib/xml2/xslt_proc.c CONFLICT (content): Merge conflict in contrib/xml2/xslt_proc.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 contrib/xml2: xslt_process() now reports XSLT-related error details When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Unstaged changes after reset: M contrib/xml2/expected/xml2.out M contrib/xml2/sql/xml2.sql M contrib/xml2/xslt_proc.c M src/backend/utils/adt/xml.c M src/include/utils/xml.h === using patch(1) to apply patch ./v3-0001-contrib-xml2-xslt_process-now-reports-XSLT-relate.patch === patching file contrib/xml2/expected/xml2.out patching file contrib/xml2/sql/xml2.sql patching file contrib/xml2/xslt_proc.c Hunk #1 succeeded at 61 with fuzz 1. Hunk #2 FAILED at 78. Hunk #3 FAILED at 141. Hunk #4 succeeded at 167 with fuzz 1 (offset 6 lines). Hunk #5 FAILED at 175. 3 out of 5 hunks FAILED -- saving rejects to file contrib/xml2/xslt_proc.c.rej patching file src/backend/utils/adt/xml.c Hunk #1 succeeded at 2130 (offset 52 lines). patching file src/include/utils/xml.h Unstaged changes after reset: M contrib/xml2/expected/xml2.out M contrib/xml2/sql/xml2.sql M contrib/xml2/xslt_proc.c M src/backend/utils/adt/xml.c M src/include/utils/xml.h Removing contrib/xml2/xslt_proc.c.rej === using 'git apply' to apply patch ./v3-0001-contrib-xml2-xslt_process-now-reports-XSLT-relate.patch === Applied patch to 'contrib/xml2/expected/xml2.out' cleanly. Applied patch to 'contrib/xml2/sql/xml2.sql' cleanly. Applied patch to 'contrib/xml2/xslt_proc.c' with conflicts. Applied patch to 'src/backend/utils/adt/xml.c' cleanly. Applied patch to 'src/include/utils/xml.h' cleanly. U contrib/xml2/xslt_proc.c diff --cc contrib/xml2/xslt_proc.c index c8e7dd45ed5,2aa44d39e7a..00000000000 --- a/contrib/xml2/xslt_proc.c +++ b/contrib/xml2/xslt_proc.c @@@ -58,9 -58,13 +58,13 @@@ xslt_process(PG_FUNCTION_ARGS volatile xsltSecurityPrefsPtr xslt_sec_prefs = NULL; volatile xsltTransformContextPtr xslt_ctxt = NULL; volatile int resstat = -1; - xmlChar *resstr = NULL; + volatile xmlChar *resstr = NULL; int reslen = 0; + /* the previous libxslt error context */ + xmlGenericErrorFunc saved_errfunc; + void *saved_errcxt; + if (fcinfo->nargs == 3) { paramstr = PG_GETARG_TEXT_PP(2); @@@ -141,11 -155,10 +155,18 @@@ xml_ereport(xmlerrcxt, ERROR, ERRCODE_INVALID_ARGUMENT_FOR_XQUERY, "failed to apply stylesheet"); ++<<<<<<< ours + resstat = xsltSaveResultToString((xmlChar **) &resstr, &reslen, + restree, stylesheet); + + if (resstat >= 0) + result = cstring_to_text_with_len((char *) resstr, reslen); ++======= + resstat = xsltSaveResultToString(&resstr, &reslen, restree, stylesheet); + if (resstat < 0 || pg_xml_error_occurred(xmlerrcxt)) + xml_ereport(xmlerrcxt, ERROR, ERRCODE_INVALID_ARGUMENT_FOR_XQUERY, + "failed to save result to string"); ++>>>>>>> theirs } PG_CATCH(); { @@@ -159,10 -172,9 +180,11 @@@ xsltFreeStylesheet(stylesheet); if (doctree != NULL) xmlFreeDoc(doctree); + if (resstr != NULL) + xmlFree((xmlChar *) resstr); xsltCleanupGlobals(); + xsltSetGenericErrorFunc(saved_errcxt, saved_errfunc); pg_xml_done(xmlerrcxt, true); PG_RE_THROW(); @@@ -176,14 -188,13 +198,24 @@@ xmlFreeDoc(doctree); xsltCleanupGlobals(); ++<<<<<<< ours + if (resstr) + xmlFree((xmlChar *) resstr); + + pg_xml_done(xmlerrcxt, false); + + /* XXX this is pretty dubious, really ought to throw error instead */ + if (resstat < 0) + PG_RETURN_NULL(); ++======= + xsltSetGenericErrorFunc(saved_errcxt, saved_errfunc); + pg_xml_done(xmlerrcxt, false); + + result = cstring_to_text_with_len((char *) resstr, reslen); + + if (resstr) + xmlFree(resstr); ++>>>>>>> theirs PG_RETURN_TEXT_P(result); #else /* !USE_LIBXSLT */