diff --git a/srcpkgs/libvirt/files/musl-fork-nofree.patch b/srcpkgs/libvirt/files/musl-fork-nofree.patch index 4e68084031..aa6597b88d 100644 --- a/srcpkgs/libvirt/files/musl-fork-nofree.patch +++ b/srcpkgs/libvirt/files/musl-fork-nofree.patch @@ -33,9 +33,19 @@ diff -ur src/util/vircommand.c src/util/vircommand.c if (cmd->env) execve(binary, cmd->args, cmd->env); -diff -ur src/util/virlog.c src/util/virlog.c ---- src/util/virlog.c -+++ src/util/virlog.c +diff -ur src/util/virlog.h src/util/virlog.h +--- src/util/virlog.h ++++ src/util/virlog.h +@@ -168,6 +168,7 @@ + void virLogLock(void); + void virLogUnlock(void); + int virLogReset(void); ++int virLogResetWithoutFree(void); + int virLogParseDefaultPriority(const char *priority); + int virLogPriorityFromSyslog(int priority); + void virLogMessage(virLogSourcePtr source, +--- src/util/virlog.c 2021-05-03 11:02:51.455354200 +0200 ++++ src/util/virlog.c 2021-05-08 11:56:58.414314487 +0200 @@ -108,8 +108,8 @@ */ static virLogPriority virLogDefaultPriority = VIR_LOG_DEFAULT; @@ -44,7 +54,7 @@ diff -ur src/util/virlog.c src/util/virlog.c -static void virLogResetOutputs(void); +static void virLogResetFilters(bool freemem); +static void virLogResetOutputs(bool freemem); - static void virLogOutputToFd(virLogSourcePtr src, + static void virLogOutputToFd(virLogSource *src, virLogPriority priority, const char *filename, @@ -284,8 +284,30 @@ @@ -124,14 +134,3 @@ diff -ur src/util/virlog.c src/util/virlog.c virLogFilters = filters; virLogNbFilters = nfilters; virLogUnlock(); -diff -ur src/util/virlog.h src/util/virlog.h ---- src/util/virlog.h -+++ src/util/virlog.h -@@ -168,6 +168,7 @@ - void virLogLock(void); - void virLogUnlock(void); - int virLogReset(void); -+int virLogResetWithoutFree(void); - int virLogParseDefaultPriority(const char *priority); - int virLogPriorityFromSyslog(int priority); - void virLogMessage(virLogSourcePtr source, diff --git a/srcpkgs/libvirt/patches/improve-generic-mass-close-of-fds.patch b/srcpkgs/libvirt/patches/improve-generic-mass-close-of-fds.patch deleted file mode 100644 index 6647588f3f..0000000000 --- a/srcpkgs/libvirt/patches/improve-generic-mass-close-of-fds.patch +++ /dev/null @@ -1,131 +0,0 @@ -https://www.redhat.com/archives/libvir-list/2020-August/msg00598.html - -Add a portable generic implementation of virMassClose as fallback on -non-FreeBSD and non-glibc. - -This implementation uses poll(2) to look for open files to keep -performance reasonable while not using any mallocs. - -This solves a deadlock with musl libc. - -Signed-off-by: Natanael Copa ---- - src/util/vircommand.c | 76 +++++++++++++++++++++++++++++++++---------- - 1 file changed, 58 insertions(+), 18 deletions(-) - -diff -ur src/util/vircommand.c src/util/vircommand.c ---- src/util/vircommand.c -+++ src/util/vircommand.c -@@ -443,7 +443,7 @@ - return 0; - } - --# ifdef __linux__ -+# if defined(__linux__) && defined(__GLIBC__) - /* On Linux, we can utilize procfs and read the table of opened - * FDs and selectively close only those FDs we don't want to pass - * onto child process (well, the one we will exec soon since this -@@ -478,17 +478,7 @@ - - return 0; - } -- --# else /* !__linux__ */ -- --static int --virCommandMassCloseGetFDsGeneric(virCommandPtr cmd G_GNUC_UNUSED, -- virBitmapPtr fds) --{ -- virBitmapSetAll(fds); -- return 0; --} --# endif /* !__linux__ */ -+# endif /* __linux__ && __GLIBC__ */ - - # ifdef __FreeBSD__ - -@@ -542,7 +532,7 @@ - return 0; - } - --# else /* ! __FreeBSD__ */ -+# elif defined(__GLIBC__) /* ! __FreeBSD__ */ - - static int - virCommandMassClose(virCommandPtr cmd, -@@ -569,13 +559,8 @@ - - fds = virBitmapNew(openmax); - --# ifdef __linux__ - if (virCommandMassCloseGetFDsLinux(cmd, fds) < 0) - return -1; --# else -- if (virCommandMassCloseGetFDsGeneric(cmd, fds) < 0) -- return -1; --# endif - - fd = virBitmapNextSetBit(fds, 2); - for (; fd >= 0; fd = virBitmapNextSetBit(fds, fd)) { -@@ -593,6 +578,61 @@ - return 0; - } - -+#else /* ! __FreeBSD__ && ! __GLIBC__ */ -+static int -+virCommandMassClose(virCommandPtr cmd, -+ int childin, -+ int childout, -+ int childerr) -+{ -+ static struct pollfd pfds[1024]; -+ int fd = 0; -+ int i, total; -+ int max_fd = sysconf(_SC_OPEN_MAX); -+ -+ if (max_fd < 0) { -+ virReportSystemError(errno, "%s", _("sysconf(_SC_OPEN_MAX) failed")); -+ return -1; -+ } -+ -+ total = max_fd - fd; -+ for (i = 0; i < (total < 1024 ? total : 1024); i++) -+ pfds[i].events = 0; -+ -+ while (fd < max_fd) { -+ int nfds, r = 0; -+ -+ total = max_fd - fd; -+ nfds = total < 1024 ? total : 1024; -+ -+ for (i = 0; i < nfds; i++) -+ pfds[i].fd = fd + i; -+ -+ do { -+ r = poll(pfds, nfds, 0); -+ } while (r == -1 && errno == EINTR); -+ -+ if (r < 0) { -+ virReportSystemError(errno, "%s", _("poll() failed")); -+ return -1; -+ } -+ -+ for (i = 0; i < nfds; i++) -+ if (pfds[i].revents != POLLNVAL) { -+ if (pfds[i].fd == childin || pfds[i].fd == childout || pfds[i].fd == childerr) -+ continue; -+ if (!virCommandFDIsSet(cmd, pfds[i].fd)) { -+ VIR_MASS_CLOSE(pfds[i].fd); -+ } else if (virSetInherit(pfds[i].fd, true) < 0) { -+ virReportSystemError(errno, _("failed to preserve fd %d"), pfds[i].fd); -+ return -1; -+ } -+ } -+ fd += nfds; -+ } -+ return 0; -+} -+ - # endif /* ! __FreeBSD__ */ - - /* diff --git a/srcpkgs/libvirt/template b/srcpkgs/libvirt/template index 1b7f3740c5..28824ed7f7 100644 --- a/srcpkgs/libvirt/template +++ b/srcpkgs/libvirt/template @@ -1,6 +1,6 @@ # Template file for 'libvirt' pkgname=libvirt -version=7.2.0 +version=7.3.0 revision=1 build_style=meson configure_args="-Dqemu_user=libvirt -Dqemu_group=libvirt -Drunstatedir=/run" @@ -19,7 +19,7 @@ license="LGPL-2.1-or-later" homepage="https://libvirt.org" changelog="https://libvirt.org/news.html" distfiles="https://libvirt.org/sources/${pkgname}-${version}.tar.xz" -checksum=01f459d0c7ba5009622a628dba1a026200e8f4a299fea783b936a71d7e0ed1d0 +checksum=27bdbb85c0301475ab1f2ecd185c629ea0bfd5512bef3f6f1817b6c55d1dc1be # FIX https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=701649 system_accounts="libvirt"