From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts Date: Sat, 09 Apr 2011 10:20:42 +0300 Message-ID: <83d3kvubzp.fsf@gnu.org> References: <4D9CC60D.2090301@cs.ucla.edu> <4D9D68D8.6060200@cs.ucla.edu> <8339ltvrok.fsf@gnu.org> <4D9E21FB.70802@cs.ucla.edu> <83vcypt8zf.fsf@gnu.org> <4D9F9B74.6050908@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1302334659 27442 80.91.229.12 (9 Apr 2011 07:37:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 9 Apr 2011 07:37:39 +0000 (UTC) Cc: 8435@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Apr 09 09:37:35 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q8Sje-0002UX-I4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Apr 2011 09:37:34 +0200 Original-Received: from localhost ([127.0.0.1]:59650 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8Sjd-0006Kw-Sb for geb-bug-gnu-emacs@m.gmane.org; Sat, 09 Apr 2011 03:37:33 -0400 Original-Received: from [140.186.70.92] (port=48924 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8SjQ-0006GA-He for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2011 03:37:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8SjP-0006wA-4F for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2011 03:37:20 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:54669) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8SjP-0006vw-13 for bug-gnu-emacs@gnu.org; Sat, 09 Apr 2011 03:37:19 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q8SVa-0001ZU-8D; Sat, 09 Apr 2011 03:23:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 09 Apr 2011 07:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8435-submit@debbugs.gnu.org id=B8435.13023337726021 (code B ref 8435); Sat, 09 Apr 2011 07:23:02 +0000 Original-Received: (at 8435) by debbugs.gnu.org; 9 Apr 2011 07:22:52 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q8SVP-0001Z3-S5 for submit@debbugs.gnu.org; Sat, 09 Apr 2011 03:22:52 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q8SVN-0001Yp-27 for 8435@debbugs.gnu.org; Sat, 09 Apr 2011 03:22:50 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0LJD00E00J34O300@a-mtaout21.012.net.il> for 8435@debbugs.gnu.org; Sat, 09 Apr 2011 10:22:42 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.229.239.68]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LJD00ERHJ5TF890@a-mtaout21.012.net.il>; Sat, 09 Apr 2011 10:22:42 +0300 (IDT) In-reply-to: <4D9F9B74.6050908@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 09 Apr 2011 03:23:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:45708 Archived-At: > Date: Fri, 08 Apr 2011 16:34:12 -0700 > From: Paul Eggert > 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.