Skip to content

package file permissions problem R 3.0.0/Windows OS

7 messages · John Fox, Paul Gilbert, Brian Ripley

#
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:
sysname                      release
                   "Windows"                      "7 x64"
                     version                     nodename
"build 7601, Service Pack 1"              "JOHN-DELL-XPS"
                     machine                        login
                       "x86"                       "User"
                        user               effective_user
                      "User"                       "User"
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:
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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: permissions-R-3.0.0.png
Type: image/png
Size: 18571 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20130414/ad8d50b7/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: permissions-R-2.5.2.png
Type: image/png
Size: 21694 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-devel/attachments/20130414/ad8d50b7/attachment-0001.png>
#
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.)

What are those screen shots of?

R 2.5.2 was a very long time ago.  A recent change is

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

Can you try using an external tar?  (Using the internal tar on Windows 
was first trialled in 2.15.3.)
On 14/04/2013 22:17, John Fox wrote:

  
    
#
Dear Brian,

On Mon, 15 Apr 2013 06:56:26 +0100
Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
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)?
7zip, which I use on Windows to manage file archives.
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.
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.
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.

Thanks for your help,
 John
#
On 15/04/2013 14:11, John Fox wrote:
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.
Ah, so that's a listing of the .tar.gz, a graphical form of tar -tvf.
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.

  
    
#
On 13-04-15 03:19 PM, Prof Brian Ripley wrote:
I am just having the opposite problem, sliksvn is adding x permission on 
checkout, to some but not all files. Not sure why and I don't want it 
to, so would be happy to hear suggestions.

Paul
#
Dear Brian,

I hope that I can clarify the issue and not confuse it further. I apologize if I was less than clear.

I originally built the tarball for the sem package on my Windows 7 system using "R CMD build" via RStudio with R 3.0.0. Both my Windows 7 system and the Windows 8 system that I subsequently also used to build the package tarball use the NTFS file system. Of course, these are Windows file systems and don't use the Unix permission scheme, but there are apparently permissions recorded in the tarball, and they caused problems for you when I submitted the package to CRAN. The permissions are visible when I look inside the tarball, e.g., with 7zip. 

When I rebuilt the package using "R CMD build" with R 2.15.2 (as opposed to 3.0.0) on both of these Windows systems, the permissions inside the tarball were correct.

I never built the package on my Linux system, although I did try building it on my Mac. I obtained correct permissions inside the tarball when I did, which isn't surprising. 

If it's the case that package tarballs built under Windows don't have execute permissions set where these are needed (as for cleanup), won't you have the same problem when such tarballs are submitted to CRAN that you had with the sem package?

Also, I'm still not clear why the execute permissions were set properly when I created the tarball having set R_BUILD_TAR=tar or using R 2.15.2.

To reiterate, if this issue is unique to me, I can certainly work around it. I know that it's hard to diagnose this kind of problem long-distance via email.

Best,
 John

On Mon, 15 Apr 2013 20:19:21 +0100
Prof Brian Ripley <ripley at stats.ox.ac.uk> wrote:
#
John,

Taking this off-list.   I suspect this is pretty much unique to you, but 
we will see.  I am about to add a para to 'Writing R Extensions' along 
the lines of

'Where a non-POSIX file system is in use which does not utilize execute 
permissions, some care is needed with permissions. This applies on 
Windows and to e.g. FAT-formatted drives and SMB-mounted file systems on 
other OSes. The ?mode? of the file recorded in the tarball will be 
whatever file.info() returns. On Windows this will record only 
directories with execute permission and on other OSes it is likely that 
all files have reported ?mode? 0777. A particular issue is packages 
being built on Windows which are intended to contain executable scripts 
such as configure and cleanup: it is difficult to include these from 
Windows but where Cygwin has been used to set a POSIX-like mode, using 
environment variable R_BUILD_TAR=tar.exe may provide a workaround.'

Brian
On 15/04/2013 21:28, John Fox wrote: