GNU bug report logs - #34792
27.0.50; format %x and %X don't print as unsigned

Previous Next

Package: emacs;

Reported by: Ivan Andrus <darthandrus <at> gmail.com>

Date: Sat, 9 Mar 2019 00:59:01 UTC

Severity: normal

Found in version 27.0.50

Done: Ivan Andrus <darthandrus <at> gmail.com>

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 34792 in the body.
You can then email your comments to 34792 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#34792; Package emacs. (Sat, 09 Mar 2019 00:59:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ivan Andrus <darthandrus <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 09 Mar 2019 00:59:02 GMT) Full text and rfc822 format available.

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

From: Ivan Andrus <darthandrus <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 27.0.50; format %x and %X don't print as unsigned
Date: Fri, 8 Mar 2019 17:58:19 -0700
The following snippets return strings with negative signs, but the
docstring of format says they should be unsigned.  I get the same
results from emacs -Q as well

(format "%s_%X%X" "bob" (random) (random))
;; "bob_143E5019B284E085-3D71BF28F82AFD0"
(format "%s_%x%x" "bob" (random) (random))
;; "bob_114d97ac7a6b2a84-15fcceadc374b70e"


-Ivan

In GNU Emacs 27.0.50 (build 7, x86_64-apple-darwin18.2.0, NS appkit-1671.20 Version 10.14.3 (Build 18D109))
of 2019-03-08 built on iandrus-macOS
Repository revision: dd77d672d8a9529ce8d4a0649be1b44bbd1a03b1
Repository branch: master
Windowing system distributor 'Apple', version 10.3.1671
System Description:  Mac OS X 10.14.3

Recent messages:
Mark set
Occurrence 1/2 in buffer
find-function-library: Symbol’s function definition is void: ## [2 times]
C-h C-u is undefined
Mark saved where search started
Mark set [2 times]
"bob_-3D1C1371061ABEA-1D876D356D7D25DF"
Saving file /Users/iandrus/.emacs.d/init.el...
Wrote /Users/iandrus/.emacs.d/init.el
Undo! [2 times]

Configured using:
'configure
PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig:/usr/local/opt/libxml2/lib/pkgconfig
--with-sound=yes --with-ns --with-modules --with-file-notification=yes
--enable-gcc-warnings=warn-only --with-xpm --with-jpeg --with-tiff
--with-gif --with-png --with-rsvg --with-xml2 --with-imagemagick
--with-json --with-xft --with-libotf --with-gnutls=no --with-makeinfo
--with-libgmp'

Configured features:
RSVG IMAGEMAGICK GLIB NOTIFY KQUEUE ACL LIBXML2 ZLIB TOOLKIT_SCROLL_BARS
XIM NS MODULES THREADS PDUMPER GMP

Important settings:
 value of $LANG: en_US.UTF-8
 locale-coding-system: utf-8-unix

Major mode: ELisp:Dyn




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34792; Package emacs. (Sat, 09 Mar 2019 02:04:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Ivan Andrus <darthandrus <at> gmail.com>
Cc: 34792 <at> debbugs.gnu.org
Subject: Re: bug#34792: 27.0.50; format %x and %X don't print as unsigned
Date: Fri, 08 Mar 2019 21:03:49 -0500
Ivan Andrus wrote:

> The following snippets return strings with negative signs, but the
> docstring of format says they should be unsigned. 

See etc/NEWS 'Numbers formatted via...'

I don't understand the "bignums, a planned feature." in that entry.
It makes it sound like bignum will be implemented in future, but they
already are?

Also the sense of the entry seems backwards, since binary-as-unsigned is
nil by default (but from editfns.c I see "it depends").

Anyway, it seems like the doc the 'format' function wasn't updated.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34792; Package emacs. (Sat, 09 Mar 2019 18:50:02 GMT) Full text and rfc822 format available.

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

From: Ivan Andrus <darthandrus <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 34792 <at> debbugs.gnu.org
Subject: Re: bug#34792: 27.0.50; format %x and %X don't print as unsigned
Date: Sat, 9 Mar 2019 11:48:51 -0700
On Mar 8, 2019, at 7:03 PM, Glenn Morris <rgm <at> gnu.org> wrote:
> 
> Ivan Andrus wrote:
> 
>> The following snippets return strings with negative signs, but the
>> docstring of format says they should be unsigned. 
> 
> See etc/NEWS 'Numbers formatted via...'
> 
> I don't understand the "bignums, a planned feature." in that entry.
> It makes it sound like bignum will be implemented in future, but they
> already are?
> 
> Also the sense of the entry seems backwards, since binary-as-unsigned is
> nil by default (but from editfns.c I see "it depends").
> 
> Anyway, it seems like the doc the 'format' function wasn't updated.

Thanks! I should have thought to check NEWS.

I took the liberty for pushing a change to the docstring to master.  Hopefully, it's acceptable.

-Ivan



bug closed, send any further explanations to 34792 <at> debbugs.gnu.org and Ivan Andrus <darthandrus <at> gmail.com> Request was from Ivan Andrus <darthandrus <at> gmail.com> to control <at> debbugs.gnu.org. (Sat, 09 Mar 2019 18:50:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34792; Package emacs. (Sat, 09 Mar 2019 22:55:01 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: 34792 <at> debbugs.gnu.org
Cc: Ivan Andrus <darthandrus <at> gmail.com>, Paul Eggert <eggert <at> cs.ucla.edu>
Subject: Re: bug#34792: 27.0.50; format %x and %X don't print as unsigned
Date: Sat, 09 Mar 2019 17:54:19 -0500
(Adding explicit cc:)

>> See etc/NEWS 'Numbers formatted via...'
>> 
>> I don't understand the "bignums, a planned feature." in that entry.
>> It makes it sound like bignum will be implemented in future, but they
>> already are?
>> 
>> Also the sense of the entry seems backwards, since binary-as-unsigned is
>> nil by default (but from editfns.c I see "it depends").
>> 
>> Anyway, it seems like the doc the 'format' function wasn't updated.
>
> Thanks! I should have thought to check NEWS.
>
> I took the liberty for pushing a change to the docstring to master.

I think this area may still need some updating.
(It feels like it predates the addition of bignum support?)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34792; Package emacs. (Mon, 11 Mar 2019 06:50:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Glenn Morris <rgm <at> gnu.org>, 34792 <at> debbugs.gnu.org
Cc: Ivan Andrus <darthandrus <at> gmail.com>
Subject: Re: bug#34792: 27.0.50; format %x and %X don't print as unsigned
Date: Sun, 10 Mar 2019 23:49:05 -0700
[Message part 1 (text/plain, inline)]
Glenn Morris wrote:
> I think this area may still need some updating.
> (It feels like it predates the addition of bignum support?)

Yes, you're right on both counts. I installed the attached patches to master to 
try to fix this.
[0001-Improve-binary-as-unsigned-treatment-Bug-34792.patch (text/x-patch, attachment)]
[0002-src-editfns.c-Fix-docstring-typo.patch (text/x-patch, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 08 Apr 2019 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 9 days ago.

Previous Next


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