[Rd] seek() and gzfile() on 32-bit R2.12.0 in linux

From: Brandon Whitcher <bwhitcher_at_gmail.com>
Date: Tue, 22 Jun 2010 18:04:32 +0100


I have installed both 32-bit and 64-bit versions of R2.12.0 (2010-06-15 r52300) on my Ubuntu 10.04 64-bit system. I observe the following behavior when running the examples from base::connections. There appears to be a problem with seek() on a .gz file when using a 32-bit installation of R2.12.0, but the problem doesn't appear in the 64-bit installation. I realize that seek() has been difficult in the past, and I don't want to open old wounds, but is this a known problem? Is this easily fixable? I have a package that relies on seek() when accessing gzipped files.

Using the 32-bit installation...

*> zz <- file("ex.data", "w") # open an output file connection
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
> cat("One more line\n", file = zz)
> close(zz)
> blah = file("ex.data", "r")
> seek(blah)

[1] 0
>
> zz <- gzfile("ex.gz", "w") # compressed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
> close(zz)
> blah = file("ex.gz", "r")
> seek(blah)

[1] 7.80707e+17
>
> zz <- bzfile("ex.bz2", "w") # bzip2-ed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep =
"\n")
> close(zz)
> blah = file("ex.bz2", "r")
> seek(blah)

Error in seek.connection(blah) : 'seek' not enabled for this connection
>*

Using the 64-bit installation...

*> zz <- file("ex.data", "w") # open an output file connection
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> cat("One more line\n", file = zz)
> close(zz)
> blah = file("ex.data", "r")
> seek(blah)

[1] 0
>
> zz <- gzfile("ex.gz", "w") # compressed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> close(zz)
> blah = file("ex.gz", "r")
> seek(blah)

[1] 0
>
> zz <- bzfile("ex.bz2", "w") # bzip2-ed file
> cat("TITLE extra line", "2 3 5 7", "", "11 13 17", file = zz, sep = "\n")
> close(zz)
> blah = file("ex.bz2", "r")
> seek(blah)

Error in seek.connection(blah) : 'seek' not enabled for this connection
> *

thanks,

Brandon

        [[alternative HTML version deleted]]



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Tue 22 Jun 2010 - 17:06:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jun 2010 - 09:01:15 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive