[Rd] zip.unpack() crashes R (PR#2818)

hb at maths.lth.se hb at maths.lth.se
Tue Apr 22 18:23:28 MEST 2003


Full_Name: Henrik Bengtsson
Version: R v1.7.0
OS: WinXP Pro
Submission from: (NULL) (130.235.2.229)


There seems to be an upper limit of the number of files (approx 1000 files) a
zip-file can contain when unpacking it with zip.unpack(). This results in an R
crash. This bug is urgent since install.packages() relies on zip.unpack() and
too big packages/bundles won't install with the current R v1.7.0 for Windows.

The following R script creates a directory with N files and zips it and tries to
unpack it again. Try with a large number on N (N=1003 is probably enough) and R
will crash. The traceback from Dr. Mingw is pasted at the end.

# 1. Running the script several times with N = 900 crashes R or generates 
# the error:
# Error in zip.unpack("dir.zip", "c:/tmp") :
#        can not set length of non-vector
# 2. Running the script twice with N = 1002 crashes R
# 3. Running the script twice with N = 1003 crashes R (every time?)
# 4. Running the script twice with N = 2000 crashes R (every time!)
N <- 1003

# Create an directory with N files
dest <- "dir"
dir.create(dest)
files <- list.files(dest)
nMissing <- (N - length(files))
if (nMissing > 0) {
  idx <- (length(files)+1):N
  filename <- sapply(as.integer(idx), FUN=sprintf, fmt="file%05d.txt")
  pathname <- paste(dest, filename, sep="/")
  for (k in seq(pathname))
    cat(file=pathname[k], 0)
}

# Create a zip archive of the directory
zipper <- "C:/cygwin/bin/jar -cfM"
cmd <- paste(zipper, " ", dest, ".zip", " ", dest, sep="")
system(cmd)

# Unse zip.unpack(), which is used by install.packages(), to unpack it.
zip.unpack("dir.zip", "c:/tmp")


# From Dr. Mingw:
# Rterm.exe caused an Access Violation at location 004d2a04 in module R.dll
Writing to location 0235f4cc.
# 
# Registers:
# eax=0235f4c8 ebx=0235e508 ecx=0235a511 edx=00000fc0 esi=00637b90 edi=80000000
# eip=004d2a04 esp=0022c840 ebp=0022c868 iopl=0         nv up ei pl nz na po nc
# cs=001b  ss=0023  ds=0023  es=0023  fs=0038  gs=0000             efl=00000206
# 
# Call stack:
# 004D2A04  R.dll:004D2A04  malloc
# 0054FEFA  R.dll:0054FEFA  Rf_allocVector
# 0051AA10  R.dll:0051AA10  call_S
# 0051ABB7  R.dll:0051ABB7  call_S
# 0051AF18  R.dll:0051AF18  do_int_unzip
# 00559594  R.dll:00559594  do_internal
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052BA52  R.dll:0052BA52  do_begin
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052BA52  R.dll:0052BA52  do_begin
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052BA52  R.dll:0052BA52  do_begin
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052A6B5  R.dll:0052A6B5  Rf_applyClosure
# 0052A1D7  R.dll:0052A1D7  Rf_eval
# 0052CCE6  R.dll:0052CCE6  do_eval
# 00559594  R.dll:00559594  do_internal
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052A6B5  R.dll:0052A6B5  Rf_applyClosure
# 0052A1D7  R.dll:0052A1D7  Rf_eval
# 0052C2D5  R.dll:0052C2D5  do_set
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052BA52  R.dll:0052BA52  do_begin
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052B427  R.dll:0052B427  do_for
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052BA52  R.dll:0052BA52  do_begin
# 0052A3C8  R.dll:0052A3C8  Rf_eval
# 0052A6B5  R.dll:0052A6B5  Rf_applyClosure
# 0052A1D7  R.dll:0052A1D7  Rf_eval
# 0054996E  R.dll:0054996E  Rf_ReplIteration
# 00549F72  R.dll:00549F72  Rf_ReplIteration
# 0054AA76  R.dll:0054AA76  run_Rmainloop
# 00401571  Rterm.exe:00401571
# 0040141E  Rterm.exe:0040141E
# 004017B3  Rterm.exe:004017B3
# 00401165  Rterm.exe:00401165
# 00401013  Rterm.exe:00401013
# 77E814C7  kernel32.dll:77E814C7  GetCurrentDirectoryW


# Platform (a fresh R installation):
#  > R.version
#  	    _
#  platform i386-pc-mingw32
#  arch     i386
#  os       mingw32
#  system   i386, mingw32
#  status
#  major    1
#  minor    7.0
#  year     2003
#  month    04
#  day      16
#  language R



More information about the R-devel mailing list