From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Eggert Newsgroups: gmane.emacs.bugs Subject: bug#8435: misuse of error ("...%d...", ...) on 64-bit hosts Date: Sun, 10 Apr 2011 10:03:21 -0700 Organization: UCLA Computer Science Department Message-ID: <4DA1E2D9.2070306@cs.ucla.edu> 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> <83d3kvubzp.fsf@gnu.org> <4DA0A448.7000203@cs.ucla.edu> <83tye7s2cf.fsf@gnu.org> <4DA0B60F.6010909@cs.ucla.edu> <83pqovrxap.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1302455258 2714 80.91.229.12 (10 Apr 2011 17:07:38 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 10 Apr 2011 17:07:38 +0000 (UTC) Cc: 8435-done@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 10 19:07:34 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 1Q8y6n-0000um-Rt for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Apr 2011 19:07:34 +0200 Original-Received: from localhost ([127.0.0.1]:48846 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8y6n-0000D5-9K for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Apr 2011 13:07:33 -0400 Original-Received: from [140.186.70.92] (port=56517 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q8y6i-0000Cp-CB for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2011 13:07:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q8y6h-0001s3-8u for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2011 13:07:28 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:57100) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q8y6h-0001ry-77 for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2011 13:07:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1Q8y3O-0000CM-M1 for bug-gnu-emacs@gnu.org; Sun, 10 Apr 2011 13:04:02 -0400 Resent-From: Paul Eggert Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Apr 2011 17:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: cc-closed 8435 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Mail-Followup-To: 8435@debbugs.gnu.org, eggert@cs.ucla.edu Original-Received: via spool by 8435-done@debbugs.gnu.org id=D8435.1302455017729 (code D ref 8435); Sun, 10 Apr 2011 17:04:02 +0000 Original-Received: (at 8435-done) by debbugs.gnu.org; 10 Apr 2011 17:03:37 +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 1Q8y2z-0000Bh-7O for submit@debbugs.gnu.org; Sun, 10 Apr 2011 13:03:37 -0400 Original-Received: from smtp.cs.ucla.edu ([131.179.128.62]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q8y2w-0000BU-JZ for 8435-done@debbugs.gnu.org; Sun, 10 Apr 2011 13:03:35 -0400 Original-Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp.cs.ucla.edu (Postfix) with ESMTP id E881F39E80F5; Sun, 10 Apr 2011 10:03:27 -0700 (PDT) X-Virus-Scanned: amavisd-new at smtp.cs.ucla.edu Original-Received: from smtp.cs.ucla.edu ([127.0.0.1]) by localhost (smtp.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3qvv3nU8eEZ9; Sun, 10 Apr 2011 10:03:27 -0700 (PDT) Original-Received: from [192.168.1.10] (pool-71-189-109-235.lsanca.fios.verizon.net [71.189.109.235]) by smtp.cs.ucla.edu (Postfix) with ESMTPSA id 33E4439E80DB; Sun, 10 Apr 2011 10:03:27 -0700 (PDT) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 In-Reply-To: <83pqovrxap.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sun, 10 Apr 2011 13:04: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:45731 Archived-At: On 04/09/2011 01:21 PM, Eli Zaretskii wrote: >> Date: Sat, 09 Apr 2011 12:39:59 -0700 >> From: Paul Eggert >> >> As Emacs evolves, if we find that more lines of code are affected, >> then the tradeoffs will change. If that happens, it shouldn't >> be hard to come up with a doprnt replacement that uses >> vsnprintf internally and that also handles multibyte character >> truncation and non-8-bit codepoints. > > I'd prefer that we do this now. OK, please feel free to do that. To help move this along, I resurrected src/doprnt.c in my patch, and merged it into the trunk, along with all the other patches I've been testing that have to do with GCC 4.6.0's static checks. Currently Emacs is not using src/doprnt.c but it shouldn't be hard to refactor the code to use doprnt again if that's what you prefer. This should result in some simplification of vsnprintf's two callers verror and vmessage. I still don't think it's worth the hassle, given Emacs's current usage (but I guess you've been warned :-). If you take this project on, you need to fix the 64-bit related problems in doprnt. For example, it's not safe to copy a string length into an 'int'. I've mentioned other bugs in this area, and I'm sure there are others that I haven't mentioned (I gave up on doprnt before fully analyzing it). I'm going to mark this bug as "done", since the bug itself is fixed now, and we're now talking about refactoring the fix.