[Top][All Lists]

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

Re: file sizes shown incorrectly for large files under Windows

From: Jason Rumney
Subject: Re: file sizes shown incorrectly for large files under Windows
Date: 13 Nov 2003 21:14:25 +0000
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Eli Zaretskii" <address@hidden> writes:

> > I am not sure that it is a good idea to modify 'struct stat' at all now 
> > that I have thought about it. It is likely to introduce other bugs
> Could you elaborate?  What kind of bugs did you have in mind?

I don't have time to look through all the uses of struct stat in the
source, but in most cases they are not in platform specific code, so
probably expect a type of off_t for stat.size. 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.

> AFAIK, on other platforms, either `stat' supports 64-bit sizes or you
> need a 64-bit build for that.

Windows falls into the latter category.

> this problem _is_ Windows-specific because Windows system calls
> support 64-bit sizes, but its `struct stat' does not.

Is it really worth putting effort into working around deficiencies in
the Windows C libraries when the effect is purely aesthetic? There
are far more important bugs that need looking at.

> > Perhaps a better fix is for the Windows definition of stat() in w32.c to 
> > check nFileSizeLow, and set buf->st_size to ULONG_MAX when it is 
> > non-zero, so that files larger than 4Gb appear as 4Gb in directory 
> > listings instead of wrapping.
> That will only solve the problem for files up to 4GB.  The 26GB file
> that started this thread will still have a wrong size inside Emacs.

It solves the problem that an enormous file might appear to be small
in a directory listing, causing a user to try to open it by mistake,
which is the only critical problem with the current behaviour I see.

reply via email to

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