Owner: -1 !
Control: tags -1 + patch

On Monday, February 22 2021, Robert Pluim wrote:
> This should now be fixed in emacs-master.

Thanks.

I have backported the fix to the Debian Emacs package.  This proved to
be a little bit harder than I expected.  Let me explain.

First, the upstream patch itself (commit a728135a2b) doesn't (always)
work out of the box because the 'dns-query' function on lisp/net/dns.el
doesn't return nil when there is no DNS configured in the machine (e.g.,
/etc/resolv.conf doesn't exist or is empty).  This has been fixed
upstream by commit 00f7744c1b0f.  However, since we're in hard freeze
now, I don't feel comfortable changing a behaviour of a user-visible
function at the moment.

Having said that, I chose to modify the upstream patch that makes the
testcase skip tests when there is no internet and make it *always*
assume that there is no internet available.  This is true for our build
systems, which is good enough for me.

I am attaching the debdiff that fixes the bug here, but I also went
ahead, prepared an NMU and uploaded it to DELAYED/7.

Rob, feel free to either cancel the upload and patch the package
yourself, or let the upload proceed.  If the NMU is uploaded, I will
also file an unblock bug against the release team.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/

diff -Nru emacs-27.1+1/debian/changelog emacs-27.1+1/debian/changelog
--- emacs-27.1+1/debian/changelog       2020-11-07 17:16:23.000000000 -0500
+++ emacs-27.1+1/debian/changelog       2021-03-20 17:41:44.000000000 -0400
@@ -1,3 +1,12 @@
+emacs (1:27.1+1-3.1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * d/p/0014-Skip-tests-that-require-Internet-when-there-s-no-Int.patch:
+    Skip tests that require internet connection, fixing a FTBFS.
+    (Closes: #982969)
+
+ -- Sergio Durigan Junior <sergi...@debian.org>  Sat, 20 Mar 2021 17:41:44 
-0400
+
 emacs (1:27.1+1-3) unstable; urgency=medium
 
   * Strip parent path from package descriptions for reprodcibility.  Add
diff -Nru emacs-27.1+1/debian/.git-dpm emacs-27.1+1/debian/.git-dpm
--- emacs-27.1+1/debian/.git-dpm        2020-11-07 17:16:23.000000000 -0500
+++ emacs-27.1+1/debian/.git-dpm        2021-03-20 17:41:44.000000000 -0400
@@ -1,6 +1,6 @@
 # see git-dpm(1) from git-dpm package
-d1c7856ed466f639a9496c05a64d1b9f3af88c80
-d1c7856ed466f639a9496c05a64d1b9f3af88c80
+c49f9362b3861b208b629ee850574f83b848386f
+c49f9362b3861b208b629ee850574f83b848386f
 d429af9a70839a40bba83ebeaa33ad8d7219fbcd
 d429af9a70839a40bba83ebeaa33ad8d7219fbcd
 emacs_27.1+1.orig.tar.xz
diff -Nru 
emacs-27.1+1/debian/patches/0014-Skip-tests-that-require-Internet-when-there-s-no-Int.patch
 
emacs-27.1+1/debian/patches/0014-Skip-tests-that-require-Internet-when-there-s-no-Int.patch
--- 
emacs-27.1+1/debian/patches/0014-Skip-tests-that-require-Internet-when-there-s-no-Int.patch
 1969-12-31 19:00:00.000000000 -0500
+++ 
emacs-27.1+1/debian/patches/0014-Skip-tests-that-require-Internet-when-there-s-no-Int.patch
 2021-03-20 17:41:44.000000000 -0400
@@ -0,0 +1,165 @@
+From c49f9362b3861b208b629ee850574f83b848386f Mon Sep 17 00:00:00 2001
+From: Robert Pluim <rpl...@gmail.com>
+Date: Mon, 22 Feb 2021 15:48:06 +0100
+Subject: Skip tests that require Internet when there's no Internet
+
+Bug#46641
+
+The network-stream-tests actually work fine when the local machine has
+no IP at all, but cause a crash in the GnuTLS library when there is an
+IP configured but the interface is down.
+
+* test/lisp/net/network-stream-tests.el (internet-is-working): New
+defvar, checks if we can resolve "google.com".
+(connect-to-tls-ipv4-nowait, connect-to-tls-ipv6-nowait)
+(open-network-stream-tls-nowait, open-gnutls-stream-new-api-nowait)
+(open-gnutls-stream-old-api-nowait): Use it to check for working
+Internet access.
+
+* test/src/process-tests.el (internet-is-working): New defvar, checks
+if we can resolve "google.com".
+(lookup-family-specification, lookup-unicode-domains)
+(unibyte-domain-name, lookup-google, non-existent-lookup-failure): Use
+it to check for working Internet access.
+
+XXX DEBIAN: This patch was adjusted to always consider that we don't
+have internet available during tests.
+
+Origin: backport, 
https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=a728135a2b551917588425d9758c6cc932cb591b
+Reviewed-By: Sergio Durigan Junior <sergi...@debian.org>
+Bug-Debian: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=982969
+Bug: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=46641
+---
+ test/lisp/net/network-stream-tests.el | 20 ++++++++++++++++++++
+ test/src/process-tests.el             | 26 +++++++++++++++++++-------
+ 2 files changed, 39 insertions(+), 7 deletions(-)
+
+diff --git a/test/lisp/net/network-stream-tests.el 
b/test/lisp/net/network-stream-tests.el
+index a0df0a26672..699c2da97cf 100644
+--- a/test/lisp/net/network-stream-tests.el
++++ b/test/lisp/net/network-stream-tests.el
+@@ -30,6 +30,21 @@
+ ;; it pulls in nsm, which then makes the :nowait t' tests fail unless
+ ;; we disable the nsm, which we do by binding 'network-security-level'
+ 
++;; Check if the Internet seems to be working.  Mainly to pacify
++;; Debian's CI system.
++;;
++;; XXX DEBIAN COMMENT: We explicitly set this variable to nil because
++;; we know that there is no internet connection during build time.
++;; Also, our version of 'dns-query' does not properly return 'nil'
++;; when the interface is configured but there is no DNS configured.
++;; Although this has been fixed upstream (see commit 00f7744c1b0f), I
++;; chose not to backport the patch because it's a non-trivial change
++;; of behaviour.
++(defvar internet-is-working nil)
++;; (progn
++;;   (require 'dns)
++;;   (dns-query "google.com")))
++
+ (ert-deftest make-local-unix-server ()
+   (skip-unless (featurep 'make-network-process '(:family local)))
+   (let* ((file (make-temp-name "/tmp/server-test"))
+@@ -280,6 +295,7 @@
+ (ert-deftest connect-to-tls-ipv4-nowait ()
+   (skip-unless (executable-find "gnutls-serv"))
+   (skip-unless (gnutls-available-p))
++  (skip-unless internet-is-working)
+   (let ((server (make-tls-server 44331))
+         (times 0)
+         (network-security-level 'low)
+@@ -322,6 +338,7 @@
+ (ert-deftest connect-to-tls-ipv6-nowait ()
+   (skip-unless (executable-find "gnutls-serv"))
+   (skip-unless (gnutls-available-p))
++  (skip-unless internet-is-working)
+   (skip-unless (not (eq system-type 'windows-nt)))
+   (skip-unless (featurep 'make-network-process '(:family ipv6)))
+   (let ((server (make-tls-server 44333))
+@@ -406,6 +423,7 @@
+ (ert-deftest open-network-stream-tls-nowait ()
+   (skip-unless (executable-find "gnutls-serv"))
+   (skip-unless (gnutls-available-p))
++  (skip-unless internet-is-working)
+   (let ((server (make-tls-server 44335))
+         (times 0)
+         (network-security-level 'low)
+@@ -634,6 +652,7 @@
+ (ert-deftest open-gnutls-stream-new-api-nowait ()
+   (skip-unless (executable-find "gnutls-serv"))
+   (skip-unless (gnutls-available-p))
++  (skip-unless internet-is-working)
+   (let ((server (make-tls-server 44668))
+         (times 0)
+         (network-security-level 'low)
+@@ -672,6 +691,7 @@
+ (ert-deftest open-gnutls-stream-old-api-nowait ()
+   (skip-unless (executable-find "gnutls-serv"))
+   (skip-unless (gnutls-available-p))
++  (skip-unless internet-is-working)
+   (let ((server (make-tls-server 44669))
+         (times 0)
+         (network-security-level 'low)
+diff --git a/test/src/process-tests.el b/test/src/process-tests.el
+index 66a76fd33b8..f54bcf05047 100644
+--- a/test/src/process-tests.el
++++ b/test/src/process-tests.el
+@@ -329,12 +329,24 @@ See Bug#30460."
+                                                   invocation-directory))
+                  :stop t)))
+ 
+-;; All the following tests require working DNS, which appears not to
+-;; be the case for hydra.nixos.org, so disable them there for now.
++;; Check if the Internet seems to be working.  Mainly to pacify
++;; Debian's CI system.
++;;
++;; XXX DEBIAN COMMENT: We explicitly set this variable to nil because
++;; we know that there is no internet connection during build time.
++;; Also, our version of 'dns-query' does not properly return 'nil'
++;; when the interface is configured but there is no DNS configured.
++;; Although this has been fixed upstream (see commit 00f7744c1b0f), I
++;; chose not to backport the patch because it's a non-trivial change
++;; of behaviour.
++(defvar internet-is-working nil)
++;; (progn
++;;   (require 'dns)
++;;   (dns-query "google.com")))
+ 
+ (ert-deftest lookup-family-specification ()
+   "network-lookup-address-info should only accept valid family symbols."
+-  (skip-unless (not (getenv "EMACS_HYDRA_CI")))
++  (skip-unless internet-is-working)
+   (should-error (network-lookup-address-info "google.com" 'both))
+   (should (network-lookup-address-info "google.com" 'ipv4))
+   (when (featurep 'make-network-process '(:family ipv6))
+@@ -342,18 +354,18 @@ See Bug#30460."
+ 
+ (ert-deftest lookup-unicode-domains ()
+   "Unicode domains should fail"
+-  (skip-unless (not (getenv "EMACS_HYDRA_CI")))
++  (skip-unless internet-is-working)
+   (should-error (network-lookup-address-info "faß.de"))
+   (should (network-lookup-address-info (puny-encode-domain "faß.de"))))
+ 
+ (ert-deftest unibyte-domain-name ()
+   "Unibyte domain names should work"
+-  (skip-unless (not (getenv "EMACS_HYDRA_CI")))
++  (skip-unless internet-is-working)
+   (should (network-lookup-address-info (string-to-unibyte "google.com"))))
+ 
+ (ert-deftest lookup-google ()
+   "Check that we can look up google IP addresses"
+-  (skip-unless (not (getenv "EMACS_HYDRA_CI")))
++  (skip-unless internet-is-working)
+   (let ((addresses-both (network-lookup-address-info "google.com"))
+         (addresses-v4 (network-lookup-address-info "google.com" 'ipv4)))
+     (should addresses-both)
+@@ -362,7 +374,7 @@ See Bug#30460."
+     (should (network-lookup-address-info "google.com" 'ipv6))))
+ 
+ (ert-deftest non-existent-lookup-failure ()
+-  (skip-unless (not (getenv "EMACS_HYDRA_CI")))
++  (skip-unless internet-is-working)
+   "Check that looking up non-existent domain returns nil"
+   (should (eq nil (network-lookup-address-info "emacs.invalid"))))
+ 
diff -Nru emacs-27.1+1/debian/patches/series emacs-27.1+1/debian/patches/series
--- emacs-27.1+1/debian/patches/series  2020-11-07 17:16:23.000000000 -0500
+++ emacs-27.1+1/debian/patches/series  2021-03-20 17:41:44.000000000 -0400
@@ -11,3 +11,4 @@
 0011-emacs-module-tests-fix-VPATH-builds.patch
 0012-Strip-parent-path-from-package-descriptions-for-repr.patch
 0013-Recover-the-contents-of-the-schemas.xml-file.patch
+0014-Skip-tests-that-require-Internet-when-there-s-no-Int.patch

Attachment: signature.asc
Description: PGP signature

Reply via email to