emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: file sizes shown incorrectly for large files under Windows


From: Chris Moore
Subject: Re: file sizes shown incorrectly for large files under Windows
Date: Fri, 14 Nov 2003 00:32:17 +0100

Eli Zaretskii writes:

 > Is the Windows definition of off_t 32-bit as well?

~/MinGW/2.0.0-3/include/sys/types.h says:
typedef long _off_t;

and sizeof(long) is 4.

 > > So you might be tempted to change the definition of off_t instead
 > > of the type of stat.size, but then you are likely to break other
 > > structures and functions that use off_t.
 >
 > It all depends on how wide is st_size put into an off_t variable.

I didn't want to break anything so I added a new 32 bit field rather
than trying replace the existing 32 bit size field with a 64 bit
field.

I see a lot of references to st_size in fileio.c which I have done
nothing about.  That code is just as broken now as it was before,
however.  I just tried visiting a file of size 4Gb+1:

Other than fileio.c I see references to st_size in w32fns.c (in
slurp_file() and pbm_read_file(), where in both cases it's used to
malloc() the space before reading the file in, and for reading the
file in).

In the Emacs I built before applying my patch it opens without
comment, but appears to be only 1 byte long, just like dired tells me
it is.

In the Emacs I build after applying my patch it warns me:
  "File 4g-plus-1 is large (4096.000000953674MB), really open (y or n)"
(do we really need such precision?).  If I say 'y' then it opens, but
again appears to be only 1 byte long.

I don't think I would have broken anything with my changes, but I
haven't fixed everything, either, just everything that uses
file-attributes() to get a file's size.

 > > Is it really worth putting effort into working around deficiencies in
 > > the Windows C libraries when the effect is purely aesthetic?
 >
 > I don't know; the problem annoyed Chris enough to post a bug report,
 > I'm merely trying to help him get this solved.

I posted the report because I've got this mental image of Emacs as
being "the best editor", "reliable", and other such positive things.

When I see it failing to do something as apparently simple as showing
me how big my files are correctly then it upsets my mental image.

But perhaps I should just think that since I'm running Windows all
bets are off, and nothing is Emacs' fault.

Chris.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]