From ripley at stats.ox.ac.uk  Mon Apr 15 21:19:21 2013
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Mon, 15 Apr 2013 20:19:21 +0100
Subject: [Rd] package file permissions problem R 3.0.0/Windows OS
In-Reply-To: <web-453347265@cgpsrv2.cis.mcmaster.ca>
References: <002201ce3955$7ff88580$7fe99080$@mcmaster.ca>
	<516B968A.8070704@stats.ox.ac.uk>
	<web-453347265@cgpsrv2.cis.mcmaster.ca>
Message-ID: <516C52B9.9020605@stats.ox.ac.uk>

On 15/04/2013 14:11, John Fox wrote:
> Dear Brian,
>
> On Mon, 15 Apr 2013 06:56:26 +0100
>   Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
>> POSIX-style execute permission isn't a Windows concept, so it was fortuitous this ever worked.  One possibility is that Cygwin was involved, and a Cygwin emulation got set when tar unpacked the file and converted back to the tar representation when Cygwin tar produced the tarball. (The tar in Rtools is a fixed version of Cygwin tar, fixed to use Windows file paths.)
>>
>
> Recall that the problem was first detected when I submitted to CRAN
> a
new version of the sem package that I built on one of my Windows
systems. I'm guessing that you unpacked that on a Linux system. Perhaps
I misunderstand the point, but if the problem is in unpacking, then
shouldn't I see it when the package is built on R 2.15.2 (not 2.5.2 --
sorry, my typo)?

The puzzle is how you got execute permissions recorded for files on your 
Windows system.  They are not part of the Windows file system: Cygwin 
uses ACLs to emulate them.  Once the ACLs are there, a Cygwin-based tar 
will put them as permissions into the tarball.  But a native Windows 
tool would not (it might or might not capture the ACLs using a tar 
extension, but those would be ignored by most unpacking tools on a 
Unix-alike).

The issue is not really Windows: if you use a FAT file system on a 
Unix-alike you have the same problem -- this is why SMB mounts at least 
did not work on OS X for building R (and much else), and you need to be 
careful transferring directories via USB sticks (which are usually 
FAT-formatted).  That route usually makes the opposite compromise: to 
assume everything is executable.

>> What are those screen shots of?
>
> 7zip, which I use on Windows to manage file archives.

Ah, so that's a listing of the .tar.gz, a graphical form of tar -tvf.

>> R 2.5.2 was a very long time ago.  A recent change is
>
> Indeed. Again, that is my unfortunate typo -- I used 2.15.2. I wanted to confirm that I can build packages with the correct permissions on my Windows systems using an older (but recent) version of R.
>
>>
>>       ? R CMD build by default uses the internal method of tar() to
>>         prepare the tarball.  This is more likely to produce a tarball
>>         compatible with R CMD INSTALL and R CMD check: an external tar
>>         program, including options, can be specified _via_ the
>>         environment variable R_BUILD_TAR.
>>
>
> I saw that but didn't understand its import. That makes sense of a difference between R 2.15.2 and 3.0.0, though I'm not sure why this change would introduce a problem with the permissions.
>
>> Can you try using an external tar?  (Using the internal tar on Windows was first trialled in 2.15.3.)
>>
>
> Yes, when I "set R_BUILD_TAR=tar" on my Windows 8 system, the tarball for the package is built with the correct permissions under R 3.0.0. The tar should be found in the Rtools\bin directory, which is first on my path. I don't have Cygwin installed on this machine independently of Rtools.
>
> What's curious to me is that I'm seeing the problem on two different Windows system but, AFAIK, no one else has experienced a similar problem.

Very few Windows users will ever get a file that appears to 'tar' to 
have execute permissions.  For example, svn checkouts on Windows lose 
execute permissions, something which has caught me for time to time over 
the years.

> Thanks for your help,
>   John
>
>>
>> On 14/04/2013 22:17, John Fox wrote:
>>> Dear list members,
>>>
>>> I'm experiencing a file permissions problem with a package built under
>>> Windows with R 3.0.0. I've encountered the problem on two Windows computers,
>>> one running Windows 7 and the other Windows 8, and both when I build the
>>> package under RStudio or directly in a Windows console via "R CMD build".
>>>
>>> In particular, the cleanup file for the package, which as I understand it
>>> should have permissions set at rwx-r-r, instead has permissions rw-rw-rw.
>>> I've attached two .png screen shots showing how the permissions are set when
>>> the package is built under R 2.5.2 and R 3.0.0.
>>>
>>> I think that my two Windows systems are reasonably vanilla. Here are the
>>> system and session info from R 3.0.0 run from a Windows console:
>>>
>>>> Sys.info()
>>>                        sysname                      release
>>>                      "Windows"                      "7 x64"
>>>                        version                     nodename
>>> "build 7601, Service Pack 1"              "JOHN-DELL-XPS"
>>>                        machine                        login
>>>                          "x86"                       "User"
>>>                           user               effective_user
>>>                         "User"                       "User"
>>>
>>>> sessionInfo()
>>> R version 3.0.0 (2013-04-03)
>>> Platform: i386-w64-mingw32/i386 (32-bit)
>>>
>>> locale:
>>> [1] LC_COLLATE=English_United States.1252
>>> [2] LC_CTYPE=English_United States.1252
>>> [3] LC_MONETARY=English_United States.1252
>>> [4] LC_NUMERIC=C
>>> [5] LC_TIME=English_United States.1252
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>> I have the latest Rtools30 installed and on my path:
>>>
>>>> Sys.which("tar.exe")
>>>                      tar.exe
>>> "c:\\Rtools\\bin\\tar.exe"
>>>
>>> Is this a general problem or is it possible that there's something about my
>>> Windows configurations that's causing it?
>>>
>>> Any information would be appreciated.
>>>
>>> John
>>>
>>> -----------------------------------------------
>>> John Fox
>>> Senator McMaster Professor of Social Statistics
>>> Department of Sociology
>>> McMaster University
>>> Hamilton, Ontario, Canada
>>>
>>>
>>>
>>>
>>> ______________________________________________
>>> 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


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



[Rd] package file permissions problem R 3.0.0/Windows OS
Prof Brian Ripley