scp doesn't work with large (>2GB) files

openssh-unix-dev at thewrittenword.com openssh-unix-dev at thewrittenword.com
Thu Sep 13 14:01:45 EST 2001


On Wed, Sep 12, 2001 at 03:48:42PM +0100, Matthew Vernon wrote:
> Michael Stone <mstone at cs.loyola.edu> writes:
> 
> > 
> > On Wed, Sep 12, 2001 at 12:14:47PM +0100, M.C. Vernon wrote:
> > > On Wed, 12 Sep 2001, Markus Friedl wrote:
> > > > why is O_LARGEFILE needed? is this some standard API?
> > > 
> > > It's not a standard API, except on Solaris/SunOS and Linux (as far as a
> > > quick look will tell me). HP-UX 11i has this flag and notes "This is a
> > > non-standard flag which may be used by 32-bit applications to access files
> > > larger than 2 GB". OTOH, on those platforms, open() will fail on files
> > > bigger than 2GB. This seems to me a good reason to include this flag on
> > > platforms where it is defined. 
> > 
> > Actually, it's a terrible idea, because off_t will still be 32 bits.
> > What would work is
> > #define _FILE_OFFSET_BITS 64
> > which would make off_t 64 bits and add an implicit O_LARGEFILE. (That's
> > what most of the utilities using O_LARGEFILE would be doing.) You can
> > take a look at the configure routines from some of the GNU utilities
> > (e.g., fileutils) to see how they do the large file support detection.
> 
> Yes, indeed. Can this go into the next release? adding a CFLAG of
> -D_FILE_OFFSET_BITS=64 for systems like Linux would be fine. In the
> mean time, I'll add it by hand to the debian/rules file.

No! No! No!

Look at AC_SYS_LARGEFILE from autoconf 2.50! That is the solution. Do
*NOT* have _FILE_OFFSET_BITS hard-coded anywhere in OpenSSH. It's
*very very* wrong.

All you have to do is drop AC_SYS_LARGEFILE into configure.in and
bam!, largefile support. Just make sure "#include <config.h>" is the
first thing the .c files see to get the redefinitions. And, if you
explicitly do not want LFS (large file summit) support, then
--disable-largefile will do the trick.

We already do this with the version of OpenSSH we distribute and it
works. I thought we had distributed a patch against 2.9p2 but maybe we
didn't. Anyway, I can work up one against CVS.

-- 
albert chin (china at thewrittenword.com)



More information about the openssh-unix-dev mailing list