bug-bash
[Top][All Lists]
Advanced

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

Re: Bash scripting and large files: input with the read builtin from a r


From: Jonathan Nieder
Subject: Re: Bash scripting and large files: input with the read builtin from a redirection gives unexpected result with files larger than 2GB.
Date: Sun, 4 Mar 2012 13:52:35 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

Hi Chet,

Chet Ramey wrote:

> Compile and run the attached program.  If it prints out `4', which it does
> on all of the Debian systems I've tried, file offsets are limited to 32
> bits, and accessing files greater than 2 GB is going to be unreliable.

off_t is typedef'd to off64_t if you compile with -D_FILE_OFFSET_BITS=64.
The AC_SYS_LARGEFILE autoconf macro is supposed to cause bash to be
built with -D_FILE_OFFSET_BITS=64 (and seems to work that way here,
based on the result of "eu-readelf -s /bin/bash | grep open").

Jean-François is using a 64-bit architecture, where _FILE_OFFSET_BITS=64
is the default, anyway.

So I fear the problem is somewhere else.  (Maybe an "int" is used as an
offset somewhere.)

Hope that helps,
Jonathan



reply via email to

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