[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#40343: 28.0.50; dns-set-servers fails on IPv6 available Windows
From: |
Kazuhiro Ito |
Subject: |
bug#40343: 28.0.50; dns-set-servers fails on IPv6 available Windows |
Date: |
Wed, 01 Apr 2020 23:55:12 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM/1.14.9 (Gojō) APEL/10.8 EasyPG/1.0.0 Emacs/28.0 (x86_64-pc-cygwin) MULE/6.0 (HANACHIRUSATO) |
> 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