unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#38937: [PROPOSED PATCH] dns-query now represents SOA integers as integers
@ 2020-01-05  3:05 Paul Eggert
  2020-01-16  1:56 ` bug#38937: " Paul Eggert
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Eggert @ 2020-01-05  3:05 UTC (permalink / raw)
  To: 38937; +Cc: Paul Eggert

* etc/NEWS: Mention this.
* lisp/net/dns.el (dns-read-int32): Declare obsolete.
Assume bignums.
(dns-read-type): Represent SOA integers as integers, not strings.
---
 etc/NEWS        |  5 +++++
 lisp/net/dns.el | 16 +++++++---------
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/etc/NEWS b/etc/NEWS
index d6cabf8e9e..204f6692bb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -42,6 +42,11 @@ applies, and please also update docstrings as needed.
 \f
 * Incompatible Lisp Changes in Emacs 28.1
 
+** dns-query now consistently uses Lisp integers to represent integers.
+Formerly it made an exception for integer components of SOA records,
+because SOA serial numbers can exceed fixnum ranges on 32-bit platforms.
+Emacs now supports bignums so this old glitch is no longer needed.
+
 \f
 * Lisp Changes in Emacs 28.1
 
diff --git a/lisp/net/dns.el b/lisp/net/dns.el
index cefe0851f0..8fb1eb6567 100644
--- a/lisp/net/dns.el
+++ b/lisp/net/dns.el
@@ -258,10 +258,8 @@ dns-read
       (nreverse spec))))
 
 (defun dns-read-int32 ()
-  ;; Full 32 bit Integers can't be handled by 32-bit Emacsen.  If we
-  ;; use floats, it works.
-  (format "%.0f" (+ (* (dns-read-bytes 1) 16777216.0)
-		    (dns-read-bytes 3))))
+  (declare (obsolete nil "28.1"))
+  (number-to-string (dns-read-bytes 4)))
 
 (defun dns-read-type (string type)
   (let ((buffer (current-buffer))
@@ -286,11 +284,11 @@ dns-read-type
            ((eq type 'SOA)
             (list (list 'mname (dns-read-name buffer))
                   (list 'rname (dns-read-name buffer))
-                  (list 'serial (dns-read-int32))
-                  (list 'refresh (dns-read-int32))
-                  (list 'retry (dns-read-int32))
-                  (list 'expire (dns-read-int32))
-                  (list 'minimum (dns-read-int32))))
+                  (list 'serial (dns-read-bytes 4))
+                  (list 'refresh (dns-read-bytes 4))
+                  (list 'retry (dns-read-bytes 4))
+                  (list 'expire (dns-read-bytes 4))
+                  (list 'minimum (dns-read-bytes 4))))
            ((eq type 'SRV)
             (list (list 'priority (dns-read-bytes 2))
                   (list 'weight (dns-read-bytes 2))
-- 
2.17.1






^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#38937: dns-query now represents SOA integers as integers
  2020-01-05  3:05 bug#38937: [PROPOSED PATCH] dns-query now represents SOA integers as integers Paul Eggert
@ 2020-01-16  1:56 ` Paul Eggert
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Eggert @ 2020-01-16  1:56 UTC (permalink / raw)
  To: 38937-done

No further comment so I installed this minor code patch into Emacs master.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-01-16  1:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-05  3:05 bug#38937: [PROPOSED PATCH] dns-query now represents SOA integers as integers Paul Eggert
2020-01-16  1:56 ` bug#38937: " Paul Eggert

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).