Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package mysql-xml-to-csv for
openSUSE:Factory checked in at 2025-12-11 18:38:57
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mysql-xml-to-csv (Old)
and /work/SRC/openSUSE:Factory/.mysql-xml-to-csv.new.1939 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "mysql-xml-to-csv"
Thu Dec 11 18:38:57 2025 rev:3 rq:1322092 version:1.0.2
Changes:
--------
--- /work/SRC/openSUSE:Factory/mysql-xml-to-csv/mysql-xml-to-csv.changes
2024-09-18 15:27:55.295437486 +0200
+++
/work/SRC/openSUSE:Factory/.mysql-xml-to-csv.new.1939/mysql-xml-to-csv.changes
2025-12-11 18:40:37.747677427 +0100
@@ -1,0 +2,6 @@
+Thu Dec 11 01:54:43 UTC 2025 - Archie Cobbs <[email protected]>
+
+- Update to release 1.0.2.
+ + Allow invalid control characters in XML to flow through
+
+-------------------------------------------------------------------
Old:
----
mysql-xml-to-csv-1.0.1.obscpio
New:
----
mysql-xml-to-csv-1.0.2.obscpio
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ mysql-xml-to-csv.spec ++++++
--- /var/tmp/diff_new_pack.G1ou0a/_old 2025-12-11 18:40:40.091775930 +0100
+++ /var/tmp/diff_new_pack.G1ou0a/_new 2025-12-11 18:40:40.123777275 +0100
@@ -1,7 +1,7 @@
#
# spec file for package mysql-xml-to-csv
#
-# Copyright (c) 2024 SUSE LLC
+# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
Name: mysql-xml-to-csv
-Version: 1.0.1
+Version: 1.0.2
Release: 0
Summary: Convert MySQL XML output to CSV
License: Apache-2.0
++++++ _service ++++++
--- /var/tmp/diff_new_pack.G1ou0a/_old 2025-12-11 18:40:40.511793580 +0100
+++ /var/tmp/diff_new_pack.G1ou0a/_new 2025-12-11 18:40:40.531794420 +0100
@@ -2,8 +2,8 @@
<service mode="localonly" name="obs_scm">
<param name="scm">git</param>
<param
name="url">https://github.com/archiecobbs/mysql-xml-to-csv</param>
- <param name="versionformat">1.0.1</param>
- <param name="revision">1.0.1</param>
+ <param name="versionformat">1.0.2</param>
+ <param name="revision">1.0.2</param>
<param name="filename">mysql-xml-to-csv</param>
</service>
<service mode="buildtime" name="tar"/>
++++++ mysql-xml-to-csv-1.0.1.obscpio -> mysql-xml-to-csv-1.0.2.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mysql-xml-to-csv-1.0.1/CHANGES
new/mysql-xml-to-csv-1.0.2/CHANGES
--- old/mysql-xml-to-csv-1.0.1/CHANGES 2024-09-17 18:43:34.000000000 +0200
+++ new/mysql-xml-to-csv-1.0.2/CHANGES 2025-12-11 02:50:41.000000000 +0100
@@ -1,3 +1,7 @@
+Version 1.0.2 Released December 10, 2025
+
+ - Allow invalid control characters in XML to flow through
+
Version 1.0.1 Released September 17, 2024
- Added "-s" flag to specify alternate column separator
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mysql-xml-to-csv-1.0.1/configure.ac
new/mysql-xml-to-csv-1.0.2/configure.ac
--- old/mysql-xml-to-csv-1.0.1/configure.ac 2024-09-17 18:43:34.000000000
+0200
+++ new/mysql-xml-to-csv-1.0.2/configure.ac 2025-12-11 02:50:41.000000000
+0100
@@ -16,7 +16,7 @@
# limitations under the License.
#
-AC_INIT([mysql-xml-to-csv Convert MySQL XML output to CSV], [1.0.1],
[https://github.com/archiecobbs/mysql-xml-to-csv/], [mysql-xml-to-csv])
+AC_INIT([mysql-xml-to-csv Convert MySQL XML output to CSV], [1.0.2],
[https://github.com/archiecobbs/mysql-xml-to-csv/], [mysql-xml-to-csv])
AC_CONFIG_AUX_DIR(scripts)
AM_INIT_AUTOMAKE
dnl AM_MAINTAINER_MODE
@@ -50,7 +50,7 @@
# Check for required header files
AC_HEADER_STDC
-AC_CHECK_HEADERS(ctype.h errno.h stdio.h stdlib.h string.h unistd.h sys/stat.h
sys/types.h, [],
+AC_CHECK_HEADERS(assert.h ctype.h errno.h stdio.h stdlib.h string.h unistd.h
sys/stat.h sys/types.h, [],
[AC_MSG_ERROR([required header file '$ac_header' missing])])
# Check for required libraries
@@ -62,6 +62,10 @@
AC_HELP_STRING([--enable-Werror],
[enable compilation with -Werror flag (default NO)]),
[test x"$enableval" = "xyes" && CFLAGS="${CFLAGS} -Werror"])
+AC_ARG_ENABLE(assertions,
+ AS_HELP_STRING([--enable-assertions],[enable debugging sanity checks
(default NO)]),
+ [test x"$enableval" = "xyes" || AC_DEFINE(NDEBUG, 1, [disable
assertions])],
+ [AC_DEFINE(NDEBUG, 1, [disable assertions])])
# Generated files
AC_CONFIG_FILES(Makefile)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/mysql-xml-to-csv-1.0.1/main.c
new/mysql-xml-to-csv-1.0.2/main.c
--- old/mysql-xml-to-csv-1.0.1/main.c 2024-09-17 18:43:34.000000000 +0200
+++ new/mysql-xml-to-csv-1.0.2/main.c 2025-12-11 02:50:41.000000000 +0100
@@ -54,6 +54,16 @@
static int value_is_null; // the current column value is
null
static const char *null_value; // string to output for null
values (default empty)
+// This stuff is used to allow invalid control characters that Expat would
otherwise barf on
+#define INVALID_CONTROL_PLACEHOLDER '@'
+typedef struct {
+ XML_Char control; // the invalid control
character that was replaced
+ XML_Index offset; // the invalid control
character's byte offset in the input
+} invalid_control_t;
+static invalid_control_t *invalid_controls; // invalid control characters
identified in the current input
+static size_t invalid_controls_len;
+static size_t invalid_controls_alloc;
+
// Expat callback functions
static void handle_elem_start(void *data, const XML_Char *el, const XML_Char
**attrs);
static void handle_elem_text(void *data, const XML_Char *s, int len);
@@ -67,6 +77,7 @@
static void add_chars(XML_Char **strp, size_t *lenp, const XML_Char *string,
size_t nchars);
static size_t xml_strlen(const XML_Char *string);
static void free_strings(XML_Char ***arrayp, size_t *lengthp);
+static int is_invalid_control_char(int ch);
static void usage(void);
int
@@ -76,6 +87,7 @@
int want_column_names = 1; // output column names as the
first CSV row
const char *empty_output = NULL; // what to print if there are
zero rows
XML_Parser p;
+ size_t offset;
FILE *fp;
size_t r;
int i;
@@ -138,15 +150,49 @@
// Initialize parser
if ((p = XML_ParserCreate(NULL)) == NULL)
errx(1, "can't initialize parser");
+ XML_UseParserAsHandlerArg(p);
XML_SetElementHandler(p, handle_elem_start, handle_elem_end);
XML_SetCharacterDataHandler(p, handle_elem_text);
// Process file
- while (1) {
+ for (offset = 0; 1; offset += r) {
+
+ // Read more data
if ((r = fread(buf, 1, sizeof(buf), fp)) == 0 && ferror(fp))
errx(1, "error reading input");
- if (XML_Parse(p, buf, r, r == 0) == XML_STATUS_ERROR)
- errx(1, "line %u: %s", (unsigned int)XML_GetCurrentLineNumber(p),
XML_ErrorString(XML_GetErrorCode(p)));
+
+ // Identify any invalid control characters and replace them with
placeholders
+ for (i = 0; i < r; i++) {
+ const int character = buf[i] & 0xff;
+
+ if (is_invalid_control_char(character)) {
+ invalid_control_t *invalid_control;
+
+ // Extend our array, if needed
+ if (invalid_controls_len == invalid_controls_alloc) {
+ invalid_controls_alloc = (invalid_controls_alloc * 2) + 13;
+ if ((invalid_controls = realloc(invalid_controls,
+ invalid_controls_alloc * sizeof(*invalid_controls))) ==
NULL)
+ err(1, "malloc");
+ }
+
+ // Add new entry
+ invalid_control = &invalid_controls[invalid_controls_len++];
+ invalid_control->control = character;
+ invalid_control->offset = offset + i;
+
+ // Replace the invalid character with a legal character as
placeholder
+ buf[i] = INVALID_CONTROL_PLACEHOLDER;
+ }
+ }
+
+ // Process it
+ if (XML_Parse(p, buf, r, r == 0) == XML_STATUS_ERROR) {
+ errx(1, "line %u: col %u: %s",
+ (unsigned int)XML_GetCurrentLineNumber(p),
+ (unsigned int)XML_GetCurrentColumnNumber(p),
+ XML_ErrorString(XML_GetErrorCode(p)));
+ }
if (r == 0)
break;
}
@@ -156,6 +202,7 @@
printf("%s\n", empty_output);
// Clean up
+ free(invalid_controls);
XML_ParserFree(p);
fclose(fp);
@@ -214,6 +261,59 @@
if (null_value != NULL)
return;
}
+
+ /*
+ {
+ int i;
+ fprintf(stderr, "handle_elem_text:\n");
+ fprintf(stderr, " s=");
+ for (i = 0; i < len; i++)
+ fprintf(stderr, "%02x ", (int)(s[i] & 0xff));
+ fprintf(stderr, "\n");
+ fprintf(stderr, " invalid_controls_len=%d\n",
(int)invalid_controls_len);
+ fprintf(stderr, " invalid_controls_alloc=%d\n",
(int)invalid_controls_alloc);
+ fprintf(stderr, " invalid_controls=");
+ for (i = 0; i < invalid_controls_len; i++) {
+ invalid_control_t *const invalid_control = &invalid_controls[i];
+ fprintf(stderr, "%02x@%d ", (int)invalid_control->control & 0xff,
(int)invalid_control->offset);
+ }
+ fprintf(stderr, "\n");
+ }
+ */
+
+ // Un-replace invalid control characters, if any
+ if (invalid_controls_len > 0) {
+ const XML_Parser p = data;
+ const XML_Index offset = XML_GetCurrentByteIndex(p);
+ XML_Char *s2;
+ int i;
+ int j;
+
+ // Copy data so we can modify it back
+ if ((s2 = malloc(len * sizeof(*s))) == NULL)
+ err(1, "malloc");
+ memcpy(s2, s, len * sizeof(*s));
+ s = s2;
+
+ // Replace placeholders with their original invalid control characters
+ for (i = 0; i < len; i++) {
+ const XML_Char ch = s[i];
+ for (j = 0; j < invalid_controls_len; ) {
+ invalid_control_t *const invalid_control =
&invalid_controls[j];
+
+ if (invalid_control->offset == offset + i) {
+// fprintf(stderr, " replace: %02x@%d (was %02x)\n",
+// (int)invalid_control->control & 0xff,
(int)invalid_control->offset, (int)(ch & 0xff));
+ assert(ch == INVALID_CONTROL_PLACEHOLDER);
+ s2[i] = invalid_control->control;
+ memcpy(invalid_control, invalid_control + 1,
(--invalid_controls_len - j) * sizeof(*invalid_control));
+ } else
+ j++;
+ }
+ }
+ }
+
+ // Proceed
if (column_names != NULL)
add_chars(&elem_text, &elem_text_len, s, len);
else
@@ -312,6 +412,21 @@
return len;
}
+// Determine if the given character is an invalid control character (i.e., not
supported by XML 1.0)
+// Ref: https://www.w3.org/TR/xml/#charsets
+static int
+is_invalid_control_char(int ch)
+{
+ switch (ch) {
+ case '\t':
+ case '\n':
+ case '\r':
+ return 0;
+ default:
+ return ch < ' ';
+ }
+}
+
static void
free_strings(char ***arrayp, size_t *lengthp)
{
++++++ mysql-xml-to-csv.obsinfo ++++++
--- /var/tmp/diff_new_pack.G1ou0a/_old 2025-12-11 18:40:41.455833249 +0100
+++ /var/tmp/diff_new_pack.G1ou0a/_new 2025-12-11 18:40:41.515835771 +0100
@@ -1,5 +1,5 @@
name: mysql-xml-to-csv
-version: 1.0.1
-mtime: 1726591414
-commit: cf85fb504657c7a29663401935aecc2c574074b8
+version: 1.0.2
+mtime: 1765417841
+commit: b6186fb9fdcdef2711e296094437ed3f921ea8ed