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

From: Prof Brian Ripley <ripley_at_stats.ox.ac.uk>
Date: Thu, 11 Jun 2009 16:28:08 +0100 (BST)

Yes, it is by design, and not R's design at that.

How (or if) the history is saved is determined by the GUI interface in use. In this case it appears to be command-line R built with readline support, in which case the saving is done by readline's write_history. And although the history.info manual does not say so, it does open files with pemissions 0600 (and there is no provison to change this).

To claim 'wrong permissions' implies that you 'know for certain' what the permissions should be -- I don't now how you can know them unless you can point to documentation that asserts the correct value as something different.

On Wed, 10 Jun 2009, Paul Gilbert wrote:

> Nicolas.Thierry-Mieg@imag.fr wrote:
>> 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?
>>
> I`m not sure, but it may be by design. For example, users sometimes use
> passwords to connections, which one might not want accidentally recorded in a
> readable file.
>
> Paul
>> 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:

Not at all: it comes from a library R uses.

>> 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)
>>
>> ______________________________________________
>> R-devel_at_r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>
> ====================================================================================
>
> La version franšaise suit le texte anglais.
>
> ------------------------------------------------------------------------------------
>
> This email may contain privileged and/or confidential in...{{dropped:26}}
>
> ______________________________________________
> R-devel_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
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


______________________________________________ R-devel_at_r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel

Received on Thu 11 Jun 2009 - 15:32:23 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 12 Jun 2009 - 09:35:16 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive