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#8528: 24.0.50; 32-bit Emacs with apparent 128M buffer size limit Date: Thu, 21 Apr 2011 08:52:34 +0300 Message-ID: <83r58w2lst.fsf@gnu.org> References: <87bp00iqih.fsf@gmail.com> Reply-To: Eli Zaretskii NNTP-Posting-Host: lo.gmane.org X-Trace: dough.gmane.org 1303366060 30733 80.91.229.12 (21 Apr 2011 06:07:40 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 21 Apr 2011 06:07:40 +0000 (UTC) Cc: 8528@debbugs.gnu.org To: Evans Winner , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Apr 21 08:07:34 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QCn38-0003yY-E7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Apr 2011 08:07:34 +0200 Original-Received: from localhost ([::1]:57198 helo=lists2.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCn37-00065b-T7 for geb-bug-gnu-emacs@m.gmane.org; Thu, 21 Apr 2011 02:07:33 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:58058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCn33-00062w-Qz for bug-gnu-emacs@gnu.org; Thu, 21 Apr 2011 02:07:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QCn32-0008Qw-Pp for bug-gnu-emacs@gnu.org; Thu, 21 Apr 2011 02:07:29 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:48554) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QCn32-0008Qp-Lr for bug-gnu-emacs@gnu.org; Thu, 21 Apr 2011 02:07:28 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QCmq1-0007N0-SN; Thu, 21 Apr 2011 01:54:01 -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: Thu, 21 Apr 2011 05:54:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8528 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8528-submit@debbugs.gnu.org id=B8528.130336522428303 (code B ref 8528); Thu, 21 Apr 2011 05:54:01 +0000 Original-Received: (at 8528) by debbugs.gnu.org; 21 Apr 2011 05:53:44 +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 1QCmpk-0007MS-Il for submit@debbugs.gnu.org; Thu, 21 Apr 2011 01:53:44 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QCmpi-0007MC-3x for 8528@debbugs.gnu.org; Thu, 21 Apr 2011 01:53:43 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0LJZ00100MHNBT00@a-mtaout21.012.net.il> for 8528@debbugs.gnu.org; Thu, 21 Apr 2011 08:52:36 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([77.124.129.240]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LJZ000SVMZMY250@a-mtaout21.012.net.il>; Thu, 21 Apr 2011 08:52:36 +0300 (IDT) In-reply-to: <87bp00iqih.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 21 Apr 2011 01:54:01 -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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:45907 Archived-At: > From: Evans Winner > Date: Wed, 20 Apr 2011 15:04:06 -0600 > > My understanding is that a 32-bit GNU Emacs should be able > to open files up to 512 M. If I am wrong about that, please > let me know. I have compiled Emacs trunk from source > several times in the last couple of months and somewhere in > the last month or so it seems that the limit on my machine > has become 128 M. My math could be off, but on the > assumption that 128 Mebibytes = 2^27 bytes = 1024 * 131072 > bytes, and starting with emacs -Q I tried: > > $ dd if=/dev/zero of=testfile bs=1024 count=131072 > > and tried to open the file, and got: "Maximum buffer size > exceeded". This happens because of the following test in insert-file-contents: /* Arithmetic overflow can occur if an Emacs integer cannot represent the file size, or if the calculations below overflow. The calculations below double the file size twice, so check that it can be multiplied by 4 safely. Also check whether the size is negative, which can happen on a platform that allows file sizes greater than the maximum off_t value. */ if (! not_regular && ! (0 <= st.st_size && st.st_size <= MOST_POSITIVE_FIXNUM / 4)) error ("Maximum buffer size exceeded"); This test was commented out for the last 2 years, but lately it was uncommented by Paul Eggert in revision 103841 on the trunk. Paul, could you please tell where do you see twice doubling of the file size in insert-file-contents? Back in 1999, when this test was first introduced, there was indeed such doubling. But even then it was only when the REPLACE argument was non-nil (according to my reading of the code). In any case, that part of code was completely rewritten since then, and I don't believe we double the file size even once. By disabling that test, I was able to visit a 260-MB file on a 32-bit machine. So it seems like this test could be removed, if I'm not missing anything.