Package: dnsmasq
Version: 2.90-5
Severity: normal
Tags: patch
X-Debbugs-Cc: sl...@ubuntu.com
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu plucky ubuntu-patch

Dear Maintainer,

dnsmasq's autopkgtests fail when ifupdown does not come pre-installed, due
to not having an explicit test-dependency defined between the two, but
relying on networking.service during the tests.

Additionaly, in environments where systemd-resolved comes pre-installed the
tests fail with the following error message (as expected):

"""
dnsmasq: failed to create listening socket for port 53: Address already in use
"""

So let's setup the test environment in a way that contains the expected
components, but no interfering components.

In Ubuntu, the attached patch was applied to achieve the following:

  * d/t/{control,functions}: Allow running on non-ifupdown systems and work
    around systemd-resolved conflict

Thanks for considering the patch.

Cheers,
  Lukas


-- System Information:
Debian Release: trixie/sid
  APT prefers noble-updates
  APT policy: (500, 'noble-updates'), (500, 'noble-security'), (500, 'noble'), 
(100, 'noble-proposed'), (100, 'noble-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.8.0-49-generic (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), 
LANGUAGE=de_DE:en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
diff -Nru dnsmasq-2.90/debian/tests/compile-time-options 
dnsmasq-2.90/debian/tests/compile-time-options
--- dnsmasq-2.90/debian/tests/compile-time-options      2024-11-23 
18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/compile-time-options      2024-12-09 
12:50:13.000000000 +0100
@@ -4,4 +4,6 @@
 
 . debian/tests/functions
 
+purge_resolved
+restart_dnsmasq
 check_compile_time_options
diff -Nru dnsmasq-2.90/debian/tests/compile-time-options+lua 
dnsmasq-2.90/debian/tests/compile-time-options+lua
--- dnsmasq-2.90/debian/tests/compile-time-options+lua  2024-11-23 
18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/compile-time-options+lua  2024-12-09 
12:50:13.000000000 +0100
@@ -4,4 +4,6 @@
 
 . debian/tests/functions
 
+purge_resolved
+restart_dnsmasq
 check_compile_time_options +lua
diff -Nru dnsmasq-2.90/debian/tests/control dnsmasq-2.90/debian/tests/control
--- dnsmasq-2.90/debian/tests/control   2024-11-23 18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/control   2024-12-09 12:50:13.000000000 +0100
@@ -16,6 +16,7 @@
          dnsmasq,
          dnsmasq-base,
          dnsmasq-utils,
+         ifupdown
 Restrictions: needs-root,
               allow-stderr,
               isolation-container,
@@ -25,6 +26,7 @@
          bind9-dnsutils,
          dnsmasq,
          dnsmasq-base-lua,
+         ifupdown
 Restrictions: needs-root,
               allow-stderr,
               isolation-container,
@@ -34,6 +36,7 @@
          bind9-dnsutils,
          dnsmasq,
          dnsmasq-base,
+         ifupdown
 Restrictions: needs-root,
               allow-stderr,
               isolation-container,
diff -Nru dnsmasq-2.90/debian/tests/functions 
dnsmasq-2.90/debian/tests/functions
--- dnsmasq-2.90/debian/tests/functions 2024-11-23 18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/functions 2024-12-09 12:50:13.000000000 +0100
@@ -25,6 +25,19 @@
        exit 1
 }
 
+purge_resolved () {
+       # Uninstall systemd-resolved, to free port 53/UDP
+       if [ "$(systemctl is-active systemd-resolved.service)" = active ]; then
+               echo "Purging systemd-resolved  ..."
+               apt-get -yq purge systemd-resolved
+       fi
+}
+
+restart_dnsmasq () {
+       echo "Restarting dnsmasq.service"
+       systemctl restart dnsmasq.service
+}
+
 stop_dnsmasq_bind_networking () {
        systemctl stop dnsmasq.service
        systemctl stop named.service
@@ -89,7 +102,7 @@
 check_compile_time_options () {
        journalctl -b -u dnsmasq
        echo ~~~ Check compile time options...
-       journalctl -b -u dnsmasq -g '[a-z]+: ' --output cat >options.msg
+       journalctl -b -u dnsmasq -g 'options: ' --output cat >options.msg  # 
ignore previous errors
        cat options.msg
        match_or_exit options.msg ${FUNCTIONS_DIR}/options${1}.patterns
 }
diff -Nru dnsmasq-2.90/debian/tests/get-address+query-dns+check-utils 
dnsmasq-2.90/debian/tests/get-address+query-dns+check-utils
--- dnsmasq-2.90/debian/tests/get-address+query-dns+check-utils 2024-11-23 
18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/get-address+query-dns+check-utils 2024-12-09 
12:50:13.000000000 +0100
@@ -4,6 +4,7 @@
 
 . debian/tests/functions
 
+purge_resolved
 stop_dnsmasq_bind_networking
 configure_and_start_networking
 configure_and_start_bind
diff -Nru dnsmasq-2.90/debian/tests/get-address+query-dns+lua+alt 
dnsmasq-2.90/debian/tests/get-address+query-dns+lua+alt
--- dnsmasq-2.90/debian/tests/get-address+query-dns+lua+alt     2024-11-23 
18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/get-address+query-dns+lua+alt     2024-12-09 
12:50:13.000000000 +0100
@@ -4,6 +4,7 @@
 
 . debian/tests/functions
 
+purge_resolved
 stop_dnsmasq_bind_networking
 configure_and_start_networking
 configure_and_start_bind
diff -Nru dnsmasq-2.90/debian/tests/get-address+query-dns+sysv+alt 
dnsmasq-2.90/debian/tests/get-address+query-dns+sysv+alt
--- dnsmasq-2.90/debian/tests/get-address+query-dns+sysv+alt    2024-11-23 
18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/get-address+query-dns+sysv+alt    2024-12-09 
12:50:13.000000000 +0100
@@ -4,6 +4,7 @@
 
 . debian/tests/functions
 
+purge_resolved
 stop_dnsmasq_bind_networking
 configure_and_start_networking
 configure_and_start_bind
diff -Nru dnsmasq-2.90/debian/tests/verify-fix-to-bug-871958 
dnsmasq-2.90/debian/tests/verify-fix-to-bug-871958
--- dnsmasq-2.90/debian/tests/verify-fix-to-bug-871958  2024-11-23 
18:50:11.000000000 +0100
+++ dnsmasq-2.90/debian/tests/verify-fix-to-bug-871958  2024-12-09 
12:50:13.000000000 +0100
@@ -4,6 +4,8 @@
 
 . debian/tests/functions
 
+purge_resolved
+restart_dnsmasq
 check_dnsmasq_status
 
 #Done

Reply via email to