unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: 8435@debbugs.gnu.org
Subject: bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts
Date: Sat, 09 Apr 2011 10:20:42 +0300	[thread overview]
Message-ID: <83d3kvubzp.fsf@gnu.org> (raw)
In-Reply-To: <4D9F9B74.6050908@cs.ucla.edu>

> Date: Fri, 08 Apr 2011 16:34:12 -0700
> From: Paul Eggert <eggert@cs.ucla.edu>
> CC: 8435@debbugs.gnu.org
> 
> On 04/08/2011 01:58 AM, Eli Zaretskii wrote:
> 
> > So I think it would be better to fix these problems as follows:
> >   ...
> >   . Fix doprnt to avoid overflow when EMACS_INT is a 64-bit type, if
> >     it could overflow.  (I don't see such a danger, but maybe I
> >     overlook something.)
> 
> That wouldn't work, not because doprnt overflows with EMACS_INT, but
> because doprnt doesn't work with ordinary 'int': it treats all integer
> arguments as if they were EMACS_INT, and this relies on unportable
> va_arg behavior.

Then let's change doprnt to support an `int'.  With the new descriptor
you introduced for EMACS_INT, it shouldn't be a problem to leave %d
and %u for `int' data types.  Are there any problems with this
approach?

> No doubt these problems could be worked around with sufficient
> hacking, but why bother?  The main reason doprnt exists is that
> vsnprintf didn't exist back when doprnt was written, so we had to
> write it ourselves.  But now that we can rely on vsnprintf, let's use
> it rather than continuing to maintain our reinvented buggy wheel.

That would be okay if vsnprintf was a drop-in replacement.  But as we
see, it isn't: doprnt provides a few features that vsnprintf does not,
and adding that support in other places has disadvantages that I
mentioned in my previous message.  So I think we should consider also
the alternative of fixing doprnt instead.  If it proves to be
reasonably easy, I think it's preferable, since that localizes the
changes.





  reply	other threads:[~2011-04-09  7:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-06 19:59 bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts Paul Eggert
     [not found] ` <handler.8435.B.130211997010029.ack@debbugs.gnu.org>
2011-04-07  7:33   ` Paul Eggert
2011-04-07 12:29     ` Andy Moreton
2011-04-07 18:31     ` Eli Zaretskii
2011-04-07 20:43       ` Paul Eggert
2011-04-08  8:58         ` Eli Zaretskii
2011-04-08 23:34           ` Paul Eggert
2011-04-09  7:20             ` Eli Zaretskii [this message]
2011-04-09 18:24               ` Paul Eggert
2011-04-09 18:32                 ` Eli Zaretskii
2011-04-09 19:39                   ` Paul Eggert
2011-04-09 20:21                     ` Eli Zaretskii
2011-04-10  3:52                       ` Stefan Monnier
2011-04-10  5:19                         ` Eli Zaretskii
2011-04-11  1:44                           ` Stefan Monnier
2011-04-11  2:54                             ` Eli Zaretskii
2011-04-10 17:03                       ` Paul Eggert
2011-04-09 19:28                 ` Eli Zaretskii
2011-04-09 19:43                   ` Paul Eggert
2011-04-08 23:37           ` Paul Eggert
2011-04-25  0:59             ` Daniel Colascione
2011-04-25  6:42               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83d3kvubzp.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=8435@debbugs.gnu.org \
    --cc=eggert@cs.ucla.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).