[Rd] .Rhistory created with wrong permissions (PR#13752)

Nicolas.Thierry-Mieg at imag.fr Nicolas.Thierry-Mieg at imag.fr
Wed Jun 10 16:35:09 CEST 2009


Hi,


This is with a centos 5.3 x86_64 system, using R 2.8.1 (details below).

In a directory where R is invoked, at the end of a session R offers to 
"Save workspace image". Replying yes creates/updates at least two files 
in the current directory: .Rhistory and .RData.
.Rhistory is created with permissions 0600, therefore it effectively 
ignores umask. In particular, .Rhistory cannot be group-readable, which 
can be problematic in some environments.
This is not the case for .RData (created 0666, modified by umask as 
usual), so I doubt that the .Rhistory permissions are restrictive by design?
If not, it would be better to create .Rhistory 0666 and let the user 
control the actual permissions through umask.

Regards,
Nicolas Thierry-Mieg

*****************************
Steps to reproduce:

[nthierry at tryo ~]$ mkdir ttt
[nthierry at tryo ~]$ cd ttt
[nthierry at tryo ttt]$ R
<snip copyright and greeting message>
 > y<-3
 > q()
Save workspace image? [y/n/c]: y
[nthierry at tryo ttt]$ ls -la
total 20
drwxr-xr-x  2 nthierry timb 4096 Jun 10 16:21 .
drwxr-x--- 80 nthierry timb 4096 Jun 10 15:18 ..
-rw-r--r--  1 nthierry timb   61 Jun 10 16:21 .RData
-rw-------  1 nthierry timb    9 Jun 10 16:21 .Rhistory
[nthierry at tryo ttt]$



Using strace on the R process shows the following, which seems to 
confirm that the problem comes from R itself:

open(".RDataTmp", O_WRONLY|O_CREAT|O_TRUNC, 0666)
<snip>
rename(".RDataTmp", ".RData")
open(".Rhistory", O_WRONLY|O_CREAT|O_TRUNC, 0600)



*****************************
 > version
platform       x86_64-redhat-linux-gnu
arch           x86_64
os             linux-gnu
system         x86_64, linux-gnu
status
major          2
minor          8.1
year           2008
month          12
day            22
svn rev        47281
language       R
version.string R version 2.8.1 (2008-12-22)



More information about the R-devel mailing list