git » avahi.git » commit 05ce05e

0.8+r22+gfd482a7-1: FS#78644 Add fix for timeout leak; reformat

author Jan Alexander Steffens (heftig)
2023-06-08 19:25:29 UTC
committer Jan Alexander Steffens (heftig)
2023-06-08 19:25:29 UTC
parent 60623a62050bdc80b58f374e07f23ad485549598

0.8+r22+gfd482a7-1: FS#78644 Add fix for timeout leak; reformat

282.patch => 0001-avahi-discover-Don-t-decode-unicode-strings-only-byt.patch +3 -3
0001-Fix-avahi-browse-Invalid-service-type.patch => 0002-Fix-avahi-browse-Invalid-service-type.patch +2 -5
0003-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch +25 -0
0004-HACK-Install-fixes.patch +58 -0
PKGBUILD +86 -56

diff --git a/282.patch b/0001-avahi-discover-Don-t-decode-unicode-strings-only-byt.patch
similarity index 89%
rename from 282.patch
rename to 0001-avahi-discover-Don-t-decode-unicode-strings-only-byt.patch
index 9e38ad0..5efed84 100644
--- a/282.patch
+++ b/0001-avahi-discover-Don-t-decode-unicode-strings-only-byt.patch
@@ -1,4 +1,4 @@
-From bcafdcc5465091b6088532460b671f411703f90b Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Simon McVittie <smcv@debian.org>
 Date: Fri, 24 Apr 2020 11:25:41 +0100
 Subject: [PATCH] avahi-discover: Don't decode unicode strings, only
@@ -16,10 +16,10 @@ Signed-off-by: Simon McVittie <smcv@debian.org>
  1 file changed, 5 insertions(+), 3 deletions(-)
 
 diff --git a/avahi-python/avahi-discover/avahi-discover.py b/avahi-python/avahi-discover/avahi-discover.py
-index 4a2b5756..fddf4a51 100755
+index 4a2b5756343f..fddf4a518074 100755
 --- a/avahi-python/avahi-discover/avahi-discover.py
 +++ b/avahi-python/avahi-discover/avahi-discover.py
-@@ -238,15 +238,17 @@ def update_label(self,interface, protocol, name, stype, domain, host, aprotocol,
+@@ -238,15 +238,17 @@ class Main_window:
                  txts+="<b>" + _("TXT") + " <i>%s</i></b> = %s\n" % (k,v)
          else:
              txts = "<b>" + _("TXT Data:") + "</b> <i>" + _("empty") + "</i>"
diff --git a/0001-Fix-avahi-browse-Invalid-service-type.patch b/0002-Fix-avahi-browse-Invalid-service-type.patch
similarity index 91%
rename from 0001-Fix-avahi-browse-Invalid-service-type.patch
rename to 0002-Fix-avahi-browse-Invalid-service-type.patch
index 8511f3b..c3c90c7 100644
--- a/0001-Fix-avahi-browse-Invalid-service-type.patch
+++ b/0002-Fix-avahi-browse-Invalid-service-type.patch
@@ -1,4 +1,4 @@
-From 6fe6c44d953edd50c32ff6ce8fec5ac811fa3b69 Mon Sep 17 00:00:00 2001
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
 From: Asger Hautop Drewsen <asger@princh.com>
 Date: Mon, 9 Aug 2021 14:25:08 +0200
 Subject: [PATCH] Fix avahi-browse: Invalid service type
@@ -8,7 +8,7 @@ Subject: [PATCH] Fix avahi-browse: Invalid service type
  1 file changed, 3 insertions(+), 1 deletion(-)
 
 diff --git a/avahi-core/browse-service.c b/avahi-core/browse-service.c
-index 5531360..2d3fa75 100644
+index 63e0275a5cdb..ac3d2ecb271c 100644
 --- a/avahi-core/browse-service.c
 +++ b/avahi-core/browse-service.c
 @@ -103,7 +103,9 @@ AvahiSServiceBrowser *avahi_s_service_browser_prepare(
@@ -22,6 +22,3 @@ index 5531360..2d3fa75 100644
  
      if (!domain)
          domain = server->domain_name;
--- 
-2.32.0
-
diff --git a/0003-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch b/0003-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch
new file mode 100644
index 0000000..5d36efd
--- /dev/null
+++ b/0003-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch
@@ -0,0 +1,25 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Gustavo Noronha Silva <gustavo@noronha.dev.br>
+Date: Sun, 2 Jan 2022 22:29:04 -0300
+Subject: [PATCH] Do not disable timeout cleanup on watch cleanup
+
+This was causing timeouts to never be removed from the linked list that
+tracks them, resulting in both memory and CPU usage to grow larger over
+time.
+---
+ avahi-common/simple-watch.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/avahi-common/simple-watch.c b/avahi-common/simple-watch.c
+index 08d8090c7789..2a4a98920c05 100644
+--- a/avahi-common/simple-watch.c
++++ b/avahi-common/simple-watch.c
+@@ -238,7 +238,7 @@ static void cleanup_watches(AvahiSimplePoll *s, int all) {
+             destroy_watch(w);
+     }
+ 
+-    s->timeout_req_cleanup = 0;
++    s->watch_req_cleanup = 0;
+ }
+ 
+ static AvahiTimeout* timeout_new(const AvahiPoll *api, const struct timeval *tv, AvahiTimeoutCallback callback, void *userdata) {
diff --git a/0004-HACK-Install-fixes.patch b/0004-HACK-Install-fixes.patch
new file mode 100644
index 0000000..80a928f
--- /dev/null
+++ b/0004-HACK-Install-fixes.patch
@@ -0,0 +1,58 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens@gmail.com>
+Date: Thu, 8 Jun 2023 21:05:22 +0200
+Subject: [PATCH] HACK: Install fixes
+
+- Move example services to docs, see
+  https://bugs.archlinux.org/task/47822
+- Don't mkdir rundir
+- Install header symlink for compat with mdnsresponder
+---
+ avahi-compat-libdns_sd/Makefile.am | 3 +++
+ avahi-daemon/Makefile.am           | 5 +++--
+ 2 files changed, 6 insertions(+), 2 deletions(-)
+
+diff --git a/avahi-compat-libdns_sd/Makefile.am b/avahi-compat-libdns_sd/Makefile.am
+index 9a66bc0d12d9..a6e509133ca9 100644
+--- a/avahi-compat-libdns_sd/Makefile.am
++++ b/avahi-compat-libdns_sd/Makefile.am
+@@ -27,6 +27,9 @@ avahi_compat_libdns_sddir=$(includedir)/avahi-compat-libdns_sd
+ 
+ avahi_compat_libdns_sd_HEADERS = dns_sd.h
+ 
++install-data-local:
++	$(LN_S) avahi-compat-libdns_sd/dns_sd.h "$(DESTDIR)$(includedir)/dns_sd.h"
++
+ lib_LTLIBRARIES = libdns_sd.la
+ 
+ if ENABLE_TESTS
+diff --git a/avahi-daemon/Makefile.am b/avahi-daemon/Makefile.am
+index 9645e6e7c2e2..7dd38d99d16e 100644
+--- a/avahi-daemon/Makefile.am
++++ b/avahi-daemon/Makefile.am
+@@ -27,6 +27,7 @@ pkgsysconfdir=$(sysconfdir)/avahi
+ servicedir=$(pkgsysconfdir)/services
+ introspectiondir=$(datadir)/dbus-1/interfaces
+ dbussystemservicesdir=$(datadir)/dbus-1/system-services
++pkgdocdir=$(datadir)/doc/avahi
+ 
+ AM_CFLAGS+= \
+ 	-DAVAHI_DAEMON_RUNTIME_DIR=\"$(avahi_runtime_dir)/avahi-daemon/\" \
+@@ -69,7 +70,7 @@ pkgsysconf_DATA = \
+ 	avahi-daemon.conf \
+ 	hosts
+ 
+-dist_service_DATA = \
++dist_pkgdoc_DATA = \
+ 	ssh.service \
+ 	sftp-ssh.service
+ 
+@@ -169,7 +170,7 @@ xmllint:
+ 	done
+ 
+ install-data-local:
+-	test -z "$(avahi_runtime_dir)" || $(MKDIR_P) "$(DESTDIR)$(avahi_runtime_dir)"
++	$(MKDIR_P) "$(DESTDIR)$(servicedir)"
+ 
+ update-systemd:
+ 	curl http://cgit.freedesktop.org/systemd/plain/src/sd-daemon.c > sd-daemon.c
diff --git a/PKGBUILD b/PKGBUILD
index 29a96f9..97942bf 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,91 +3,121 @@
 # Contributor: Douglas Soares de Andrade <douglas@archlinux.org>
 
 pkgname=avahi
-pkgver=0.8+22+gfd482a7
-pkgrel=4
-pkgdesc='Service Discovery for Linux using mDNS/DNS-SD -- compatible with Bonjour'
-url='https://github.com/lathiat/avahi'
+pkgver=0.8+r22+gfd482a7
+pkgrel=1
+epoch=1
+pkgdesc="Service Discovery for Linux using mDNS/DNS-SD (compatible with Bonjour)"
+url="https://github.com/lathiat/avahi"
 license=(LGPL)
 arch=(x86_64)
-depends=(expat libdaemon glib2 libcap gdbm dbus)
-makedepends=(git gobject-introspection gtk3 qt5-base xmltoman python-dbus
-             python-gobject doxygen graphviz libevent)
-optdepends=('gtk3: avahi-discover, avahi-discover-standalone, bshell, bssh, bvnc'
-            'qt5-base: qt5 bindings'
-            'libevent: libevent bindings'
-            'nss-mdns: NSS support for mDNS'
-            'python-twisted: avahi-bookmarks'
-            'python-gobject: avahi-bookmarks, avahi-discover'
-            'python-dbus: avahi-bookmarks, avahi-discover')
-provides=(libavahi-client.so libavahi-common.so libavahi-core.so
-          libavahi-glib.so libavahi-gobject.so libavahi-libevent.so
-          libavahi-qt5.so libavahi-ui-gtk3.so libdns_sd.so)
-backup=(etc/avahi/{hosts,avahi-daemon.conf,avahi-{autoip,dnsconf}d.action}
-        usr/lib/avahi/service-types.db)
+depends=(
+  dbus
+  expat
+  gdbm
+  glib2
+  libcap
+  libdaemon
+)
+makedepends=(
+  doxygen
+  git
+  gobject-introspection
+  graphviz
+  gtk3
+  libevent
+  python-dbus
+  python-gobject
+  qt5-base
+  xmltoman
+)
+optdepends=(
+  'gtk3: avahi-discover, avahi-discover-standalone, bshell, bssh, bvnc'
+  'libevent: libevent bindings'
+  'nss-mdns: NSS support for mDNS'
+  'python-dbus: avahi-bookmarks, avahi-discover'
+  'python-gobject: avahi-bookmarks, avahi-discover'
+  'python-twisted: avahi-bookmarks'
+  'qt5-base: qt5 bindings'
+)
+provides=(
+  libavahi-{client,common,core,glib,gobject,libevent,qt5,ui-gtk3}.so
+  libdns_sd.so
+)
+backup=(
+  etc/avahi/{hosts,avahi-daemon.conf,avahi-{autoip,dnsconf}d.action}
+  usr/lib/avahi/service-types.db
+)
 _commit=fd482a74625b8db8547b8cfca3ee3d3c6c721423  # master
-source=("git+https://github.com/lathiat/avahi#commit=$_commit"
-        282.patch
-        0001-Fix-avahi-browse-Invalid-service-type.patch)
-sha512sums=('SKIP'
-            '26b1e74450944f5c4385d2f5df18523cfb953e4138f6d9e81061a626453e40d8ed2dee44535cfbb547848eefb3cdca408009d5f0e0c465f144a8803db8593b46'
-            'e39c17d9a5d534784a3c7b6947da994d0ab5fa354aac5cecde6d3baaa2bb3d57f02f91cc6fb68885a4e98f44efe615b01631a4c7af752aa26f35082cfcc0ddd7')
+source=(
+  "git+https://github.com/lathiat/avahi#commit=$_commit"
+  0001-avahi-discover-Don-t-decode-unicode-strings-only-byt.patch
+  0002-Fix-avahi-browse-Invalid-service-type.patch
+  0003-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch
+  0004-HACK-Install-fixes.patch
+)
+b2sums=('SKIP'
+        'a7d26bfbaa2bc488de81e9ec6d32ee64b1eaacd4e1cbecc6f896c263c2e37a036a5510d3f1c50ddcaec50251c4bd265aaf68ebe3c508016de9018aecaf2692e1'
+        '79a881a7f45b4d6061285257b07aa0f72aa69cedc636c74ec12dd031372b3560b4013f18d821e31b323fd73af5de811a1f5ba94ba0e32ce1b1bb940af3bad54f'
+        '04a100e1775e10c9dd23fb7e1c4f9f456ac9fd84abe649ca93758dfede262cfcf9dc114c40be08d53645de92bfd26071e8b1a1117e3f391ddad7c64aedc69de0'
+        '1b3fd8221b3a2d79a9425f5bd630ace0ac345ae7b7c0741957beb6755664aaff5c84d441a5c399d86945ec876eef7bbda4f5162d39e2b1701da2c4b4c233b8cc')
 
 pkgver() {
-  cd $pkgname
-  git describe --tags | sed 's/^v//;s/-/+/g'
+  cd avahi
+  git describe --tags | sed 's/^v//;s/[^-]*-g/r&/;s/-/+/g'
 }
 
 prepare() {
-  cd $pkgname
+  cd avahi
 
   # https://bugs.archlinux.org/task/68518
   # https://github.com/lathiat/avahi/pull/282
-  git apply -3 ../282.patch
+  git apply -3 ../0001-avahi-discover-Don-t-decode-unicode-strings-only-byt.patch
 
   # https://bugs.archlinux.org/task/71781
   # https://github.com/lathiat/avahi/issues/212
-  git apply -3 ../0001-Fix-avahi-browse-Invalid-service-type.patch
+  git apply -3 ../0002-Fix-avahi-browse-Invalid-service-type.patch
+
+  # https://bugs.archlinux.org/task/78644
+  # https://github.com/lathiat/avahi/pull/366
+  git apply -3 ../0003-Do-not-disable-timeout-cleanup-on-watch-cleanup.patch
+
+  # https://bugs.archlinux.org/task/47822
+  git apply -3 ../0004-HACK-Install-fixes.patch
 
   NOCONFIGURE=1 ./autogen.sh
 }
 
 build() {
-  cd $pkgname
-
-  ./configure \
-    --prefix=/usr \
-    --sysconfdir=/etc \
-    --localstatedir=/var \
-    --sbindir=/usr/bin \
-    with_dbus_sys=/usr/share/dbus-1/system.d \
-    --disable-mono \
-    --enable-compat-libdns_sd \
-    --with-distro=archlinux \
-    --with-avahi-priv-access-group=network \
-    --with-autoipd-user=avahi \
-    --with-autoipd-group=avahi \
+  local configure_options=(
+    --prefix=/usr
+    --sysconfdir=/etc
+    --localstatedir=/var
+    --sbindir=/usr/bin
+    --disable-mono
+    --enable-compat-libdns_sd
+    --with-autoipd-group=avahi
+    --with-autoipd-user=avahi
+    --with-avahi-priv-access-group=network
+    --with-distro=archlinux
     --with-systemdsystemunitdir=/usr/lib/systemd/system
-  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
+    with_dbus_sys=/usr/share/dbus-1/system.d
+  )
+
+  cd avahi
 
+  ./configure "${configure_options[@]}"
+  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
   make
 }
 
 package() {
   depends+=(libdbus-1.so)
 
-  cd $pkgname
+  cd avahi
   make DESTDIR="$pkgdir" install
 
-  rmdir "$pkgdir/run"
-
-  # mdnsresponder compat
-  ln -s avahi-compat-libdns_sd/dns_sd.h "$pkgdir/usr/include/dns_sd.h"
-
-  # move example services https://bugs.archlinux.org/task/47822
-  install -d "$pkgdir/usr/share/doc/$pkgname"
-  mv "$pkgdir"/etc/avahi/services/{,sftp-}ssh.service \
-    "$pkgdir/usr/share/doc/$pkgname/"
-
   echo 'u avahi - "Avahi mDNS/DNS-SD daemon"' |
     install -Dm644 /dev/stdin "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"
 }
+
+# vim:set sw=2 sts=-1 et: