From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Robert Pluim Newsgroups: gmane.emacs.bugs Subject: bug#46641: process-tests assume network connection Date: Sun, 21 Feb 2021 17:19:12 +0100 Message-ID: <87pn0tqtq7.fsf@gmail.com> References: <4lpn0wndla.fsf@fencepost.gnu.org> <871rd9smip.fsf@gmail.com> <87k0r1k07c.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27387"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Glenn Morris , 46641@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 21 17:20:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lDrTC-00072n-Jt for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Feb 2021 17:20:30 +0100 Original-Received: from localhost ([::1]:50976 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lDrTB-0000Z2-IP for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 21 Feb 2021 11:20:29 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51504) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lDrSl-0000Yi-0w for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 11:20:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43106) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lDrSk-0007Ir-OP for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 11:20:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lDrSk-00086E-K6 for bug-gnu-emacs@gnu.org; Sun, 21 Feb 2021 11:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Robert Pluim Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 21 Feb 2021 16:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46641 X-GNU-PR-Package: emacs Original-Received: via spool by 46641-submit@debbugs.gnu.org id=B46641.161392436431048 (code B ref 46641); Sun, 21 Feb 2021 16:20:02 +0000 Original-Received: (at 46641) by debbugs.gnu.org; 21 Feb 2021 16:19:24 +0000 Original-Received: from localhost ([127.0.0.1]:54646 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lDrS8-00084i-2J for submit@debbugs.gnu.org; Sun, 21 Feb 2021 11:19:24 -0500 Original-Received: from mail-wr1-f41.google.com ([209.85.221.41]:40473) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lDrS4-00084R-P3 for 46641@debbugs.gnu.org; Sun, 21 Feb 2021 11:19:22 -0500 Original-Received: by mail-wr1-f41.google.com with SMTP id v14so16525288wro.7 for <46641@debbugs.gnu.org>; Sun, 21 Feb 2021 08:19:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :mime-version; bh=xpFj9hn8YW4+Bx9ijrmckxEZoelTVC5Iaqh0+JOK8pw=; b=f72JBIlAEKL80qT4m8Xb4ym6+IQ7JRf14m3blkoPyWTKKx2dgTjdj1VtfjFd9m+n7N QYn2xYrQGp8OQzg4huCattZUfrnjWIDSF1CxTxhzMgxN5333OvvQ3mcVuh3cIsxSNRCH ZD8Lg4wqfEnz8t3rTMEESc5Okm49nRkFVaOgVL1bQ7VJddpkxSLD/P4AyWA44XImmr2k 8POmC5ZU6CDE6JvmwYBq/vkn7npYGOpb64HeIvsuv+O8Z84eCyl2Y730xldRMJSe0r0T n2II7dwYsmkBbBVgihWh7ByVUqxo1yVSd5k+9s/bHDehc7IgKP33jWW8BGVM1ulqo0pR qNJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:mime-version; bh=xpFj9hn8YW4+Bx9ijrmckxEZoelTVC5Iaqh0+JOK8pw=; b=QfipFhlwIjeBzdPMrphEl9UP7Z6SbzTZQxMm4F5yUZ5f8wu5vGGnC1SpdLkgep2DzA gSL2NlbxVOY67FjvVvi5kFfuLAHYoZQ1PXJFtG6Xkr91oivcVxofZRbQ0bIJ6e/oE/jm ntYOBTDPQdBKoKYy/cuxGKnq9iSyQF1+W/kXpUtEcYdad47qPWUMH7gxXisbZZ30GkJ2 CBnVLyVJ9bLHZC/6CSvY4scN0SC4Din9vc9arwgrGWEOHSAJx59eMKJnj22IBP0SfY0h RSupFWM9hbqrUVpIVsfeWEsTomLrRWYHtZwcTH99/llBNEDgJJU7bSQJjcsl9Pc7xf5W 9quw== X-Gm-Message-State: AOAM532mreqZQIk/gf3BSe6DFhw1pLqFFgWedHDLDeW4R0dstqGccg+0 fUet38Sr19W+bIXJC6zrzOnDabAicDNftA== X-Google-Smtp-Source: ABdhPJxlyAV8U+nVAxdls8BasFpHmZGZLFf3HxQYkWyYGNpE5TutZQSqbzisdWO75t6PdjtgIs/rlw== X-Received: by 2002:a05:6000:1081:: with SMTP id y1mr4136740wrw.177.1613924354317; Sun, 21 Feb 2021 08:19:14 -0800 (PST) Original-Received: from rltb ([2a01:e0a:3f3:fb50:2154:6435:5293:4d19]) by smtp.gmail.com with ESMTPSA id c62sm23396472wme.16.2021.02.21.08.19.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Feb 2021 08:19:13 -0800 (PST) In-Reply-To: <87k0r1k07c.fsf@gnus.org> (Lars Ingebrigtsen's message of "Sun, 21 Feb 2021 14:41:11 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:200501 Archived-At: >>>>> On Sun, 21 Feb 2021 14:41:11 +0100, Lars Ingebrigtsen said: >> I guess we could wrap them all in >> >> (skip-unless (dns-query "google.com")) Lars> It'd be nice if Emacs did have a predicate for "is there any network Lars> here?" But I don't know what that would look like. That is, there's a Lars> difference between having a local network (i.e., 127.0.0.1), and being Lars> on the Internet. Lars> But if any of our tests require Emacs to be on a functioning internet Lars> connection, they should indeed be guarded by something like the Lars> `skip-unless' you propose. Well, the tests in question are asking 'does emacs have a correctly functioning internet connection', so making that a prerequisite for the test seems kind of redundant, but we can do it. But first: disabling my network connection causes dns-query to hang, so something like this is needed, I think (we can skip the first hunk if you want): diff --git a/lisp/net/dns.el b/lisp/net/dns.el index 2045d4dfca..598ceebab8 100644 --- a/lisp/net/dns.el +++ b/lisp/net/dns.el @@ -332,7 +332,7 @@ dns-set-servers (setq dns-servers (nreverse dns-servers)))) (when (executable-find "nslookup") (with-temp-buffer - (call-process "nslookup" nil t nil "localhost") + (call-process "nslookup" nil t nil "-retry=0" "-timeout=2" "localhost") (goto-char (point-min)) (when (re-search-forward "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\|[[:xdigit:]:]*\\)" nil t) @@ -496,15 +496,17 @@ dns-query "Query a DNS server for NAME of TYPE. If FULL, return the entire record returned. If REVERSE, look up an IP address." - (let ((result nil)) - (dns-query-asynchronous - name - (lambda (response) - (setq result (list response))) - type full reverse) - ;; Loop until we get the callback. - (while (not result) - (sleep-for 0.01)) + (let ((result nil) + (query-started + (dns-query-asynchronous + name + (lambda (response) + (setq result (list response))) + type full reverse))) + (if query-started + ;; Loop until we get the callback. + (while (not result) + (sleep-for 0.01))) (car result))) (provide 'dns)