Bug 16677 - No tilde expansion in png(type = "cairo-png")
Summary: No tilde expansion in png(type = "cairo-png")
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Graphics (show other bugs)
Version: R-devel (trunk)
Hardware: x86_64/x64/amd64 (64-bit) Linux
: P5 minor
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2016-01-21 10:55 UTC by Mikko Korpela
Modified: 2016-01-21 10:55 UTC (History)
0 users

See Also:


Attachments
Proposed patch (494 bytes, patch)
2016-01-21 10:55 UTC, Mikko Korpela
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mikko Korpela 2016-01-21 10:55:36 UTC
Created attachment 2005 [details]
Proposed patch

When the filename argument of a png device with type = "cairo-png" contains a leading tilde, R fails to produce an output file with the expanded filename.

How to reproduce:

  png("~/A.png", type = "cairo")
  plot(1:5)
  dev.off()

  png("~/B.png", type = "cairo-png")
  plot(1:5)
  dev.off()

After these commands, "A.png" is found in the home directory, but there is no "B.png" (unless it already existed). I don't know if the second set of plotting commands created a file in some unexpected location or if no file was produced.

The expected result is to find both "A.png" and "B.png" in the home directory.

Tested on R-devel and R 3.2.3 patched, both of revision 69967.

Using the patch attached, the result from R-devel is as expected.

> sessionInfo()
R Under development (unstable) (2016-01-21 r69967)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.3 LTS

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base