unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Kazuhiro Ito <kzhr@d1.dion.ne.jp>
To: Robert Pluim <rpluim@gmail.com>
Cc: 40343@debbugs.gnu.org
Subject: bug#40343: 28.0.50; dns-set-servers fails on IPv6 available Windows
Date: Wed, 01 Apr 2020 23:55:12 +0900	[thread overview]
Message-ID: <vriud08ri7cf.wl--xmue@d1.dion.ne.jp> (raw)
In-Reply-To: <m2pncrz4td.fsf@gmail.com>

>     Kazuhiro> For example, when I tested on my standalone Debian (sid) box,
>     Kazuhiro> evaluating the below code just after starting Emacs returns annoying
>     Kazuhiro> result.
> 
>     Kazuhiro> (progn
>     Kazuhiro>   (require 'dns)
>     Kazuhiro>   (dns-set-servers)
>     Kazuhiro>   dns-servers)
> 
>     -> ("c")
> 
> Yes, but the API exposed by dns.el is 'dns-query' (and maybe
> 'dns-query-cached'). 'dns-set-servers' should probably be called
> 'dns--set-servers' to indicate that itʼs an internal function.
> 
>     Kazuhiro> We need to validate dns-servers's value to judge whether
>     Kazuhiro> dns-set-servers succeeded contorary docstring of dns-set-servers,
>     Kazuhiro> which says dns-servers is non-nil when dns-set-servers succeeded.  I
>     Kazuhiro> think docstring or actual behavior of dns-set-servers should be fixed.
> 
> See previous paragraph: itʼs an internal function.

I don't understand what you mean by "itʼs an internal function".  I
don't think it is okay that internal functions don't behave as
described in docstring.

>     Kazuhiro> I noticed another problem in dns.el.  dns-query function returns
>     Kazuhiro> message's string ("No DNS server configuration found") when
>     Kazuhiro> dns-servers is nil.
> 
> Yes, it should probably return nil, and this is actually a valid
> reason for why 'dns-set-servers' should set dns-servers to nil on
> failure. Can you determine why itʼs failing on your Debian box?

I tested on Debian box as below.

1. /etc/init.d/networking stop
2. remove nameserver entry from /etc/resolv.conf

On such condition, nslookup program outputs as below

> ;; connection timed out; no servers could be reached

Here is code snippet communicating with nslookup in dns-set-servers.

> (with-temp-buffer
>   (call-process "nslookup" nil t nil "localhost")
>   (goto-char (point-min))
>   (re-search-forward
>    "^Address:[ \t]*\\([0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+\\)" nil t)
>   (setq dns-servers (list (match-string 1))))

On the above condition, re-search-forward doesn't match anything.  But
next match-string is called unconditionally.  As far as I tested,
match-string's result when last search didn't match is undefined.  it
may return nil, string or raise an error.  Additionally, even if
match-string returns nil, dns-servers is never set to nil.  It is set
to (nil).

-- 
Kazuhiro Ito





  reply	other threads:[~2020-04-01 14:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31  8:46 bug#40343: 28.0.50; dns-set-servers fails on IPv6 available Windows Kazuhiro Ito
2020-03-31  9:50 ` Robert Pluim
2020-03-31 11:06   ` Kazuhiro Ito
2020-03-31 13:01     ` Robert Pluim
2020-03-31 14:22       ` Kazuhiro Ito
2020-03-31 14:28         ` Robert Pluim
2020-04-01 13:43           ` Kazuhiro Ito
2020-04-01 13:57             ` Robert Pluim
2020-04-01 14:55               ` Kazuhiro Ito [this message]
2020-04-03  8:42                 ` Robert Pluim
2020-04-03 14:08                   ` Kazuhiro Ito
2020-04-03 15:19                     ` Robert Pluim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vriud08ri7cf.wl--xmue@d1.dion.ne.jp \
    --to=kzhr@d1.dion.ne.jp \
    --cc=40343@debbugs.gnu.org \
    --cc=rpluim@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).