GNU bug report logs - #9514
24.0.50; eval + format weirdness

Previous Next

Package: emacs;

Reported by: Wolfgang Jenkner <wjenkner <at> inode.at>

Date: Thu, 15 Sep 2011 14:17:02 UTC

Severity: normal

Found in version 24.0.50

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 9514 in the body.
You can then email your comments to 9514 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 owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9514; Package emacs. (Thu, 15 Sep 2011 14:17:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Wolfgang Jenkner <wjenkner <at> inode.at>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 15 Sep 2011 14:17:02 GMT) Full text and rfc822 format available.

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

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: bug-gnu-emacs <at> gnu.org
Cc: eggert <at> cs.ucla.edu
Subject: 24.0.50; eval + format weirdness
Date: Thu, 15 Sep 2011 16:11:49 +0200
The form

(let* ((string (with-temp-buffer (insert "%%b") (buffer-string)))
       (form `(format ,string)))
  (list form
	(eval form)))

evaluates to

((format "%%b") "%bb")

but it should evaluate to

((format "%%b") "%b")

Note that bzr trunk rev. 104389 gives the correct result whereas
rev. 104390 gives the wrong result.

In GNU Emacs 24.0.50.1 (amd64-unknown-freebsd8.2, GTK+ Version 2.24.6)
 of 2011-09-13 on iznogoud.viz
Windowing system distributor `The X.Org Foundation', version 11.0.10707000
configured using `configure  'CC=gcc46' '--without-gsettings''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: en_US.UTF-8
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t




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

Notification sent to Wolfgang Jenkner <wjenkner <at> inode.at>:
bug acknowledged by developer. (Thu, 15 Sep 2011 16:19:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Wolfgang Jenkner <wjenkner <at> inode.at>
Cc: 9514-done <at> debbugs.gnu.org
Subject: Re: 24.0.50; eval + format weirdness
Date: Thu, 15 Sep 2011 09:14:02 -0700
Thanks for reporting that.
I fixed it in the trunk (bzr 105786).




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9514; Package emacs. (Thu, 15 Sep 2011 16:24:02 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: 9514 <at> debbugs.gnu.org
Cc: eggert <at> cs.ucla.edu
Subject: Re: bug#9514: 24.0.50; eval + format weirdness
Date: Thu, 15 Sep 2011 18:18:58 +0200
Except that this has nothing to do with eval.

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9514; Package emacs. (Thu, 15 Sep 2011 17:30:03 GMT) Full text and rfc822 format available.

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

From: Wolfgang Jenkner <wjenkner <at> inode.at>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: 9514 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9514: 24.0.50; eval + format weirdness
Date: Thu, 15 Sep 2011 19:24:57 +0200
Andreas Schwab <schwab <at> linux-m68k.org> writes:

> Except that this has nothing to do with eval.

Nor with most anything else in my example...

So a better bug report would have been

Subject: format barfs on certain strings

For example,

(format "%%é")

evaluates to garbage.

However, the paradoxical thing was rather

(let* ((string1 "%%b")
       (string2 (with-temp-buffer (insert string1) (buffer-string))))
  (list (string-equal string1 string2)
	(format string1)
	(format string2)))

=> (t "%b" "%bb")

as it wouldn't have easily occurred to me that string1 and string2 can
have different representations on the C level, which format treats
differently (though this shouldn't show ;-)

Wolfgang





Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9514; Package emacs. (Thu, 15 Sep 2011 18:21:02 GMT) Full text and rfc822 format available.

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

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Andreas Schwab <schwab <at> linux-m68k.org>
Cc: Wolfgang Jenkner <wjenkner <at> inode.at>, 9514 <at> debbugs.gnu.org
Subject: Re: bug#9514: 24.0.50; eval + format weirdness
Date: Thu, 15 Sep 2011 11:15:58 -0700
Andreas Schwab <schwab <at> linux-m68k.org> writes:
> Except that this has nothing to do with eval.

True; I fixed the ChangeLog entry to not mention eval.

The patch you just installed for text properties (bzr 105788)
causes (format "%4000s%%" "") to fail with
(error "Format string ends in middle of format specifier"),
and it causes (length (format "%%")) to incorrectly return 2.
I fixed those two problems in a further patch (bzr 105791);
I hope this also fixes the text-property issue.




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9514; Package emacs. (Fri, 16 Sep 2011 07:58:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Wolfgang Jenkner <wjenkner <at> inode.at>
Cc: 9514 <at> debbugs.gnu.org, eggert <at> cs.ucla.edu
Subject: Re: bug#9514: 24.0.50; eval + format weirdness
Date: Fri, 16 Sep 2011 09:53:03 +0200
The only issue was the mishandling of %% in a multibyte format string,
like this:

(format (string-to-multibyte "%%foo"))

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#9514; Package emacs. (Fri, 16 Sep 2011 08:12:01 GMT) Full text and rfc822 format available.

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

From: Andreas Schwab <schwab <at> linux-m68k.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: Wolfgang Jenkner <wjenkner <at> inode.at>, 9514 <at> debbugs.gnu.org
Subject: Re: bug#9514: 24.0.50; eval + format weirdness
Date: Fri, 16 Sep 2011 10:06:23 +0200
Paul Eggert <eggert <at> cs.ucla.edu> writes:

> The patch you just installed for text properties (bzr 105788)
> causes (format "%4000s%%" "") to fail with
> (error "Format string ends in middle of format specifier"),
> and it causes (length (format "%%")) to incorrectly return 2.
> I fixed those two problems in a further patch (bzr 105791);
> I hope this also fixes the text-property issue.

Thanks, looks good.  For reference, here's a testcase for the
text-property issue:

(let ((s (string-to-multibyte "%%%%foo")))
  (add-text-properties 2 7 '(foo t) s)
  (format s))

Before my patch it returned #("%%foo" 0 5 (foo t)).

Andreas.

-- 
Andreas Schwab, schwab <at> linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 14 Oct 2011 11:24:02 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 217 days ago.

Previous Next


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