From f611c7f90f794d3d06c46059a9ceb9f1ed7a2c4736027e29e960e6ca779873d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Schr=C3=B6ter?= Date: Thu, 3 Oct 2024 17:40:21 +0200 Subject: [PATCH] Sync from SUSE:SLFO:Main netcontrol revision eb96a094b8241d85f2eaad8d950514f3 --- ...l-reader-fix-xml_getc-and-xml_ungetc.patch | 124 ++++++++++++++++++ ...-uppercase-for-lt-gt-and-amp-expansi.patch | 31 +++++ netcontrol.changes | 27 +++- netcontrol.spec | 65 ++------- 4 files changed, 190 insertions(+), 57 deletions(-) create mode 100644 0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch create mode 100644 0002-xml-reader-allow-uppercase-for-lt-gt-and-amp-expansi.patch diff --git a/0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch b/0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch new file mode 100644 index 0000000..76f7e8a --- /dev/null +++ b/0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch @@ -0,0 +1,124 @@ +From ad6ac1b9685d6340ee1f430eeec0bf800b4e5fa1 Mon Sep 17 00:00:00 2001 +From: Clemens Famulla-Conrad +Date: Fri, 21 Jul 2023 15:57:42 +0200 +Subject: [PATCH 1/2] xml-reader: fix xml_getc() and xml_ungetc() +References: bsc#1213349 +Upstream: yes + + +diff --git a/src/xml-reader.c b/src/xml-reader.c +index ca7f820..e5e9587 100644 +--- a/src/xml-reader.c ++++ b/src/xml-reader.c +@@ -70,7 +70,7 @@ typedef enum { + typedef struct xml_reader { + const char * filename; + FILE * file; +- char * buffer; ++ unsigned char * buffer; + + unsigned int no_close : 1; + +@@ -107,8 +107,8 @@ static void xml_debug(const char *, ...); + static int xml_reader_init_file(xml_reader_t *xr, FILE *fp); + static int xml_reader_open(xml_reader_t *xr, const char *filename); + static int xml_reader_destroy(xml_reader_t *xr); +-static char xml_getc(xml_reader_t *xr); +-static void xml_ungetc(xml_reader_t *xr, char cc); ++static int xml_getc(xml_reader_t *xr); ++static void xml_ungetc(xml_reader_t *xr, int cc); + + /* + * Document reader implementation +@@ -463,7 +463,7 @@ xml_token_type_t + xml_get_token_initial(xml_reader_t *xr, nc_stringbuf_t *res) + { + xml_token_type_t token; +- char cc; ++ int cc; + + restart: + /* Eat initial white space and store it in @res */ +@@ -551,7 +551,7 @@ restart: + xml_token_type_t + xml_get_token_tag(xml_reader_t *xr, nc_stringbuf_t *res) + { +- char cc, oc; ++ int cc, oc; + + xml_skip_space(xr, NULL); + +@@ -632,8 +632,7 @@ error: + xml_token_type_t + xml_skip_comment(xml_reader_t *xr) + { +- int match = 0; +- char cc; ++ int match = 0, cc; + + if (xml_getc(xr) != '-') { + xml_parse_error(xr, "Unexpected element"); +@@ -668,7 +667,7 @@ int + xml_expand_entity(xml_reader_t *xr, nc_stringbuf_t *res) + { + nc_stringbuf_t entity = NC_STRINGBUF_INIT; +- char cc, expanded; ++ int cc, expanded; + + if(nc_stringbuf_grow(&entity, 128) < 0) { + xml_parse_error(xr, "Unable to allocate entity buffer"); +@@ -680,7 +679,7 @@ xml_expand_entity(xml_reader_t *xr, nc_stringbuf_t *res) + xml_parse_error(xr, "Unexpenced EOF in entity"); + return 0; + } +- if (isspace(cc)) ++ if (isspace((unsigned int)cc)) + continue; + nc_stringbuf_putc(&entity, cc); + } +@@ -720,7 +719,7 @@ good: + void + xml_skip_space(xml_reader_t *xr, nc_stringbuf_t *result) + { +- char cc; ++ int cc; + + while ((cc = xml_getc(xr)) != EOF) { + if (!isspace(cc)) { +@@ -863,10 +862,10 @@ xml_reader_destroy(xml_reader_t *xr) + return rv; + } + +-char ++int + xml_getc(xml_reader_t *xr) + { +- char cc; ++ int cc; + + while (1) { + if (xr->pos) { +@@ -883,17 +882,17 @@ xml_getc(xml_reader_t *xr) + break; + } + +- if (fgets(xr->buffer, XML_READER_BUFSZ, xr->file) == NULL) ++ if (fgets((char *)xr->buffer, XML_READER_BUFSZ, xr->file) == NULL) + break; + +- xr->pos = (unsigned char *) xr->buffer; ++ xr->pos = xr->buffer; + } + + return EOF; + } + + void +-xml_ungetc(xml_reader_t *xr, char cc) ++xml_ungetc(xml_reader_t *xr, int cc) + { + if (xr->pos == NULL + || xr->pos == (unsigned char *) xr->buffer +-- +2.35.3 + diff --git a/0002-xml-reader-allow-uppercase-for-lt-gt-and-amp-expansi.patch b/0002-xml-reader-allow-uppercase-for-lt-gt-and-amp-expansi.patch new file mode 100644 index 0000000..81d498a --- /dev/null +++ b/0002-xml-reader-allow-uppercase-for-lt-gt-and-amp-expansi.patch @@ -0,0 +1,31 @@ +From 9a38e053226d01721126a21ee80396488782995d Mon Sep 17 00:00:00 2001 +From: Clemens Famulla-Conrad +Date: Fri, 21 Jul 2023 15:59:00 +0200 +Subject: [PATCH 2/2] xml-reader: allow uppercase for <, > and & + expansion +References: bsc#1213349 +Upstream: yes + + +diff --git a/src/xml-reader.c b/src/xml-reader.c +index e5e9587..1ab16ea 100644 +--- a/src/xml-reader.c ++++ b/src/xml-reader.c +@@ -689,11 +689,11 @@ xml_expand_entity(xml_reader_t *xr, nc_stringbuf_t *res) + return 0; + } + +- if (!strcmp(entity.string, "lt")) ++ if (!strcasecmp(entity.string, "lt")) + expanded = '<'; +- else if (!strcmp(entity.string, "gt")) ++ else if (!strcasecmp(entity.string, "gt")) + expanded = '>'; +- else if (!strcmp(entity.string, "amp")) ++ else if (!strcasecmp(entity.string, "amp")) + expanded = '&'; + else { + const char *es = entity.string; +-- +2.35.3 + diff --git a/netcontrol.changes b/netcontrol.changes index b8e180a..c195efa 100644 --- a/netcontrol.changes +++ b/netcontrol.changes @@ -1,3 +1,22 @@ +------------------------------------------------------------------- +Thu Feb 22 14:01:02 UTC 2024 - Dominique Leuenberger + +- Use %autosetup macro. Allows to eliminate the usage of deprecated + %patchN + +------------------------------------------------------------------- +Tue Nov 7 21:48:46 UTC 2023 - Dirk Müller + +- spec-cleaner run + +------------------------------------------------------------------- +Fri Jul 21 15:06:25 UTC 2023 - Clemens Famulla-Conrad + +- Fix EOF handling in xml-reader to avoid `virsh iface-*` commands + hang on aarch64 (bsc#1213349) + [+ 0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch, + + 0002-xml-reader-allow-uppercase-for-lt-gt-and-amp-expansi.patch] + ------------------------------------------------------------------- Tue Jun 15 15:48:36 UTC 2021 - Marius Tomaschewski @@ -123,7 +142,7 @@ Mon Jul 2 11:00:33 UTC 2012 - mt@suse.de interface operstate to better match ifstatus results - Check type while creating topology tree as well, not only if the interface specific data exists. - - Do not report error in ncf_if_xml_state when interface + - Do not report error in ncf_if_xml_state when interface does not exists any more [has been stopped/removed]. - Improved error handling, report several errors once - Expose a lot of error details to the caller @@ -132,9 +151,9 @@ Mon Jul 2 11:00:33 UTC 2012 - mt@suse.de - Fetch mac address from system when not in the config - Fixed arp ip target bonding option handling and expose errors while trying to add not unique slave interface. - - Refresh config handle earlier in ncf_define, fixed a + - Refresh config handle earlier in ncf_define, fixed a double free in regression test it does. - - Automatically start port/slave/base interfeces when + - Automatically start port/slave/base interfeces when stating a bridge/bond/vlan. ------------------------------------------------------------------- @@ -197,7 +216,7 @@ Wed Jul 6 19:03:28 UTC 2011 - mt@suse.de - version 0.2.1, fixing config cleanup of depending interfaces while configure and delete action, ifup and ifdown actions, adding several checks and removing patch level from the API - version (fate#306765). + version (fate#306765). ------------------------------------------------------------------- Fri Jul 1 11:17:17 UTC 2011 - mt@suse.de diff --git a/netcontrol.spec b/netcontrol.spec index ca3f7f0..ae4c904 100644 --- a/netcontrol.spec +++ b/netcontrol.spec @@ -1,7 +1,7 @@ # # spec file for package netcontrol # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,39 +31,20 @@ License: LGPL-2.1-or-later Group: Productivity/Networking/System Source0: %{name}-%{version}.tar.bz2 Source1: baselibs.conf -BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} >= 1310 +Patch1: 0001-xml-reader-fix-xml_getc-and-xml_ungetc.patch +Patch2: 0002-xml-reader-allow-uppercase-for-lt-gt-and-amp-expansi.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: libnl3-devel BuildRequires: libtool -%else -%if 0%{?suse_version} >= 1210 -BuildRequires: libnl-1_1-devel -%else -BuildRequires: libnl-devel -%endif -%endif -BuildRequires: pkg-config -%if 0%{?suse_version} >= 1230 +BuildRequires: pkgconfig Requires: sysconfig >= 0.80.0 -%else -Requires: sysconfig >= 0.71.0 -%endif %description A interim network configuration library, currently implementing the libnetcf interface for libvirt. - - -Authors: --------- - Olaf Kirch - Marius Tomaschewski - %package -n libnetcontrol0 - Summary: A network configuration library Group: Productivity/Networking/System @@ -73,15 +54,7 @@ libnetcf interface for libvirt. The libnetcontrol0 package provides the shared library. - - -Authors: --------- - Olaf Kirch - Marius Tomaschewski - %package -n libnetcontrol-devel - Summary: Development header and library files Group: Development/Libraries/C and C++ Requires: libnetcontrol0 = %{version} @@ -93,43 +66,29 @@ libnetcf interface for libvirt. The libnetcontrol-devel package contains libraries and header files required for development. - - -Authors: --------- - Olaf Kirch - Marius Tomaschewski - %prep -%setup -q +%autosetup -p1 %build -export CFLAGS="-W -Wall $RPM_OPT_FLAGS" %configure \ -%if 0%{?suse_version} >= 1230 --enable-network-service \ -%endif --enable-pthreads \ --disable-static -make %{?_smp_mflags} +%make_build %install -make install DESTDIR=$RPM_BUILD_ROOT -rm -f $RPM_BUILD_ROOT%{_libdir}/*.la +%make_install +find %{buildroot} -type f -name "*.la" -delete -print -%post -n libnetcontrol0 -/sbin/ldconfig - -%postun -n libnetcontrol0 -/sbin/ldconfig +%post -n libnetcontrol0 -p /sbin/ldconfig +%postun -n libnetcontrol0 -p /sbin/ldconfig %files -n libnetcontrol0 -%defattr(-,root,root,-) %{_libdir}/*.so.* %files -n libnetcontrol-devel -%defattr(-,root,root,-) -%doc README COPYING.LGPL COPYING.GPL ChangeLog.git +%license COPYING.LGPL COPYING.GPL +%doc README ChangeLog.git %{_libdir}/*.so %{_includedir}/* %{_libdir}/pkgconfig/netcontrol.pc