Skip to content

tilde paths cause crash in R on Mac

3 messages · David Faden, Brian Ripley

#
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:
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
*** 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:
null device
          1

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

Thanks.

David
#
It is not that there is a tilde in the name, but that the filename is 
invalid (nothing said that tilde would be interpreted, and R's help 
usually does when this is the case).

The crash is AFAIK already fixed in 2.7.2 patched (and R-devel does 
interpret tildes on Mac and Windows where it did not previously).
On Fri, 5 Sep 2008, David Faden wrote:

            

  
    
#
I quoted the section of R help that says the tilde would be expanded
if supported by the platform.

On Fri, Sep 5, 2008 at 11:48 AM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote: