[Rd] file.info() on WinXP/NTFS > 2Gb

Henrik Bengtsson hb at maths.lth.se
Sat Feb 18 20:33:49 CET 2006


on WinXP Pro SP2 with NTFS, I noticed that file.info() under
Rv2.2.1pat (2006-02-09) does not report the correct file size if the
file is >= 2^31 bytes (2GB).   Is this problem known?  Is this related
to the note in ?file.info:

"Some (broken) systems allow files of more than 2Gb to be created but
not accessed by the 'stat' system call.  Such files will show up as
non-readable (and very likely not be readable by any of R's input


# Create a 2Gb(!) file, report file.info()$size, and remove the file.

fname <- "tmp.Rbin";
con <- file(fname, open="w+b");
size <- 2^31-1; # OK
size <- 2^31;    # Not OK
seek(con, where=size-1, rw="write");
writeBin(con=con, as.integer(0), size=1);

With size = c(2^31-1,2^31), file.info() reports file size
c(2147483647,-2147483648).  This looks to me like a non-signed to
signed integer case.

Note that the above code does indeed create files >2Gb on WinXP with
NTFS; I've created files about 6Gb this way.

BTW, about seek() on Windows:  I noticed the warning about using
seek() on Windows (see ?seek): "We have found so many errors in the
Windows implementation of file positioning that users are advised to
use it only at their own risk, and asked not to waste the R
developers' time with bug reports on Windows' deficiencies.".  Not
going to bug report, but I haven't noticed any problems this far. 
What errors/symptoms are expected? Is regardless of file system used,
e.g. FAT, NTFS?



More information about the R-devel mailing list