apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William A. Rowe, Jr." <wr...@rowe-clan.net>
Subject Re: apr_lstat() fails on linux for large files
Date Fri, 28 Feb 2003 19:45:19 GMT
Please don't make Linux's problem every APR user's headache,
such as autoindex you describe below.

Short of turning on largefile support here and now, what about a simple
APR hack?  Keep an overflow flag for apr_dir_t, and when the lstat()
call from apr_dir_read returns EOVERFLOW, set that flag but loop and
grab the next legal file.

Once we hit eof with readdir(), look at the overflow flag.  Go ahead and
return some APR_EOVERFLOW condition rather than EOF.  Unset
the flag so that if the user calls again, they will see the EOF.

Does that sound like it would solve this Linux issue without causing
every application undue pain?

Bill


At 01:23 PM 2/28/2003, Cliff Woolley wrote:

>I was trying to track down the cause of PR#17357, and came across
>something interesting-slash-annoying.
>
>mod_autoindex in Apache loops over the directory entries it's indexing
>using apr_dir_read().  Among other things, apr_dir_read() does an
>apr_lstat() call (which in turn calls apr_stat() with the APR_FINFO_LINK
>wanted flag) on the next entry in the directory.  If you have a large file
>(>2GB) in the directory, though, on linux the lstat() will fail with
>errno==EOVERFLOW (75) (Value too large for defined data type).  This
>causes the apr_lstat() to fail which causes the apr_dir_read() to fail
>which makes mod_autoindex think it's hit the end of the directory.
>
>
>Of course, if I go and explictly compile Apache with
>CFLAGS=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64, then it works.
>
>So I guess the ultimate questions are these:
>
>(a) Why doesn't Apache automatically include largefile support?
>Performance reasons?  Shouldn't there at least be an easy ./configure
>option to turn it on?
>
>(b) If it's not turned on, shouldn't mod_autoindex detect the EOVERFLOW
>return code and special-case it?
>
>--Cliff
>
>
>http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17357



Mime
View raw message