Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2004-02-19 09:29:25


At 01:35 AM 2/9/2004, Jonathan Ultis wrote:

>::exists is implemented using ::stat. The ::stat routine returns an
>error on file sizes larger than 2 gigs in libc-2.3.2, and several
>others. So, very large files never exists (). Using ::access seems to
>fix the problem.

The best fix for this seems to be to enable 64-bit stat support. That fixes
not just the original problem, but also fixes similar problems with other
boost::filesystem functions.

Accordingly, the implementation in CVS has been changed to #define
__USE_FILE_OFFSET64 for POSIX implementations. This should be harmless on
64-bit systems and 32-bit systems which don't support files larger than 2
gigs. But it kicks in 64-bit support on systems like Linux which do supply
Large File Support (LFS).

It has been tested on Redhat Linux 8.0 with GCC 3.2 for files requiring 31,
32, and 33 bits to represent the size. The 32 and 33 bit tests failed
before the fix, as expected, and succeeded after the fix. (Those tests
already passed for Windows.)

As well as fixing problems with older Boost.Filesystem functions, these
tests confirm that the new boost::filesystem::file_size() function works
reliably for Linux and Windows. I'd still like to get reports from AIX, Mac
OS X, Solaris, etc., confirming that
boost-root/libs/filesystem/example/file_size.cpp reliably reports sizes of
files needing more than 31 bits to represent size.

Thanks for the report,

--Beman


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk