GNU bug report logs - #38937
[PROPOSED PATCH] dns-query now represents SOA integers as integers

Previous Next

Package: emacs;

Reported by: Paul Eggert <eggert <at> cs.ucla.edu>

Date: Sun, 5 Jan 2020 03:07:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38937 in the body.
You can then email your comments to 38937 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#38937; Package emacs. (Sun, 05 Jan 2020 03:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Paul Eggert <eggert <at> cs.ucla.edu>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 05 Jan 2020 03:07:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: bug-gnu-emacs <at> gnu.org
Cc: Paul Eggert <eggert <at> cs.ucla.edu>
Subject: [PROPOSED PATCH] dns-query now represents SOA integers as integers
Date: Sat,  4 Jan 2020 19:05:57 -0800
* 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.
 
 * 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.
+
 
 * 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





Reply sent to Paul Eggert <eggert <at> cs.ucla.edu>:
You have taken responsibility. (Thu, 16 Jan 2020 01:57:01 GMT) Full text and rfc822 format available.

Notification sent to Paul Eggert <eggert <at> cs.ucla.edu>:
bug acknowledged by developer. (Thu, 16 Jan 2020 01:57:02 GMT) Full text and rfc822 format available.

Message #10 received at 38937-done <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: 38937-done <at> debbugs.gnu.org
Subject: Re: dns-query now represents SOA integers as integers
Date: Wed, 15 Jan 2020 17:56:42 -0800
No further comment so I installed this minor code patch into Emacs master.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 13 Feb 2020 12:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 45 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.