[Rd] fix for broken largefile seek() on 32-bit linux (PR#9883)
ripley at stats.ox.ac.uk
ripley at stats.ox.ac.uk
Tue Aug 28 11:34:23 CEST 2007
I've applied the patch, but I no longer have a 32-bit Linux system. Could
you please verify it has applied correctly (SVN rev 42672 on trunk, 42673
on R-patched). A quick check on 32-bit Solaris suggested it worked as
expected.
On Mon, 27 Aug 2007, jbrzusto at fastmail.fm wrote:
> Full_Name: John Brzustowski
> Version: R-devel-trunk, R-2.4.0
> OS: linux
> Submission from: (NULL) (206.248.132.197)
>
>
> DESCRIPTION
>
> seek() on files larger than 2 gigabytes fails for large values of "where" on
> i386 linux 2.6.13 (and presumably other 32-bit unix-like platforms).
>
> e.g.:
>
>> f<-file("3gigabytefile.dat", "rb")
>> seek(f, 3e9, "start", "r")
> [1] 0 ## correct
>> seek(f, NA, "start", "r")
> [1] 0 ## should be 3e+09
>
> DIAGNOSIS
>
> Typo: the compile-time tests for large file support use "HAVE_SEEKO" instead of
> "HAVE_FSEEKO", and so fail.
>
> The same typo appears in one of the extra/zlib files, so I'm fixing
> it in the patch below, but I haven't tested whether that actually
> produces a bug.
>
> PATCH
> Index: src/extra/zlib/gzio.c
> ===================================================================
> --- src/extra/zlib/gzio.c (revision 42664)
> +++ src/extra/zlib/gzio.c (working copy)
> @@ -25,7 +25,7 @@
> #include "zutil.h"
>
> /* R ADDITION */
> -#if defined(HAVE_OFF_T) && defined(HAVE_SEEKO)
> +#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO)
> #define f_seek fseeko
> #define f_tell ftello
> #else
> Index: src/include/Rconnections.h
> ===================================================================
> --- src/include/Rconnections.h (revision 42664)
> +++ src/include/Rconnections.h (working copy)
> @@ -63,7 +63,7 @@
>
> typedef struct fileconn {
> FILE *fp;
> -#if defined(HAVE_OFF_T) && defined(HAVE_SEEKO)
> +#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO)
> off_t rpos, wpos;
> #else
> #ifdef Win32
> Index: src/main/connections.c
> ===================================================================
> --- src/main/connections.c (revision 42664)
> +++ src/main/connections.c (working copy)
> @@ -446,7 +446,7 @@
>
> /* ------------------- file connections --------------------- */
>
> -#if defined(HAVE_OFF_T) && defined(HAVE_SEEKO)
> +#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO)
> #define f_seek fseeko
> #define f_tell ftello
> #else
> @@ -570,7 +570,7 @@
> {
> Rfileconn this = con->private;
> FILE *fp = this->fp;
> -#if defined(HAVE_OFF_T) && defined(HAVE_SEEKO)
> +#if defined(HAVE_OFF_T) && defined(HAVE_FSEEKO)
> off_t pos;
> #else
> #ifdef Win32
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-devel
mailing list