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

Prof Brian Ripley ripley at stats.ox.ac.uk
Fri Sep 5 20:48:42 CEST 2008


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:

> 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
>
> _______________________________________________
> R-SIG-Mac mailing list
> R-SIG-Mac at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-mac
>

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



More information about the R-SIG-Mac mailing list