Subject: Re: bug#2790: emacs 22.1.1 cannot open 5GB file on 64GB 64-bit GNU/Linux box

From: Mike Coleman <[email-masked]>
Date: Sat, 28 Mar 2009 11:27:57 -0500

On Sat, Mar 28, 2009 at 10:17 AM, Richard M Stallman <[email-masked]> wrote:
>    The smallest file that produces the error has 536870912 bytes, exactly
>    512MB.  (This is via binary search, so assumes that there is just one
>    transition from "will" to "won't" as filesize increases.)
>
> It looks like you're simply hitting the limit on buffer size.
>
> But I suspect there is a bug here, because it sounds like
> you can visit a file whose size is bigger than most-positive-fixnum.
> If you do that, what value do you get for (point-max)?
> Is it negative?  I think it will be, and that we need
> to restrict the buffer size to be no more than most-positive-fixnum.

It appears to me that visiting a file larger than 512MB is simply
failing, with the given error message about the max buffer size.
(Note that 512MB is much, much smaller than most-positive-fixnum (==
2^64).)

So, to me, it seems like the behavior is "correct", if emacs only
promises to handle files as large as 512MB (on 64-bit platforms).

Nonetheless, I'd like it to handle much larger files.  Is there any
real reason not to just turn every (32-bit) "int" into a (64-bit)
"long" on 64-bit platforms?

Mike