GNU bug report logs -
#40343
28.0.50; dns-set-servers fails on IPv6 available Windows
Previous Next
Reported by: Kazuhiro Ito <kzhr <at> d1.dion.ne.jp>
Date: Tue, 31 Mar 2020 08:48:01 UTC
Severity: normal
Found in version 28.0.50
Fixed in version 28.1
Done: Robert Pluim <rpluim <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #29 received at 40343 <at> debbugs.gnu.org (full text, mbox):
> 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
This bug report was last modified 5 years and 102 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.