[R-SIG-Mac] tilde paths cause crash in R on Mac

David Faden dfaden at gmail.com
Fri Sep 5 19:45:49 CEST 2008


Hi,

Creating a graphics device with a tilde in the file name leads to a
bus error in recent versions of R on the Mac. I'm running Mac OS X
10.5.4. A sample session:

> sessionInfo()
R version 2.7.2 (2008-08-25)
i386-apple-darwin8.11.1

locale:
en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base
> png("~/bye.png")
> plot(1:10)
> dev.off()

 *** caught bus error ***
address 0x5, cause 'non-existent physical address'

Traceback:
 1: dev.off()

Possible actions:
1: abort (with core dump, if enabled)
2: normal R exit
3: exit R without saving workspace
4: exit R saving workspace
Fri Sep  5 10:38:44 dhcp-172-22-124-177.corp.google.com R[819]
<Error>: CGImageDestinationCreate destination parameter is nil\n
Fri Sep  5 10:38:44 dhcp-172-22-124-177.corp.google.com R[819]
<Error>: CGImageDestinationAddImage image destination parameter is
nil\n
Fri Sep  5 10:38:44 dhcp-172-22-124-177.corp.google.com R[819]
<Error>: CGImageDestinationFinalize image destination parameter is
nil\n

...

A solution is to just throw in a call to expand.path:

> png(path.expand("~/bye.png"))
> plot(1:10)
> dev.off()
null device
          1

It seems such a call is implied by the documentation: "Tilde expansion
is performed where supported by the platform."

Thanks.

David



More information about the R-SIG-Mac mailing list