Hi, using too long pathnames for bitmap() crash R on WinXP. I've verified that this is the case with R version 2.4.1 Patched (2007-03-25 r40958) and R version 2.5.0 alpha (2007-03-30 r40957). I cannot reproduce it on Linux.
REPRODUCIBLE EXAMPLE: % Rterm --vanilla # Tell R where Ghostscript is gsexe <- "C:/gs/gs8.54/bin/gswin32c.exe"; gsexe <- "C:/Program Files/gs/gs8.56/bin/gswin32c.exe"; gsexe <- shortPathName(gsexe); Sys.putenv("R_GSCMD"=gsexe); # Total length of pathname (R crashes when it is too long) n <- 130; # Output path path <- tempdir(); # Filename name <- paste(rep("a", n-5-nchar(path)), collapse=""); filename <- paste(name, "png", sep="."); # Full pathname pathname <- file.path(path, filename); print(pathname); stopifnot(nchar(pathname) == n); bitmap(pathname); plot(1); dev.off(); R crash with dev.off(), but the PNG file is still created. # MORE DETAILED EXAMPLE: n <- 130; path <- tempdir(); name <- paste(rep("a", n-5-nchar(path)), collapse=""); filename <- paste(name, "png", sep="."); pathname <- file.path(path, filename); print(pathname); # Tell R where Ghostscript is gsexe <- "C:/gs/gs8.54/bin/gswin32c.exe"; gsexe <- "C:/Program Files/gs/gs8.56/bin/gswin32c.exe"; gsexe <- shortPathName(gsexe); cmd <- paste(gsexe, " -dNOPAUSE -dBATCH -q -sDEVICE=png256 -r72 -g432x432 -sOutputFile=", pathname, sep=""); print(cmd); print(nchar(cmd)); tmp <- tempfile(); postscript(file=tmp, width=6, height=6, pointsize=9, paper="special", horizontal=FALSE, print.it=TRUE, command=cmd); plot(1); dev.off(); It seems to have to do with the length of 'cmd' (since the possible pathname length varies with the length of 'gsexe' used). Any ideas? /Henrik ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel