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

From: Henrik Bengtsson <hb_at_maths.lth.se>
Date: Sat 18 Feb 2006 - 19:33:49 GMT


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 functions)."


# 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); close(con);

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?



R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun Feb 19 06:36:46 2006

This archive was generated by hypermail 2.1.8 : Mon 20 Feb 2006 - 03:21:41 GMT