From simon.urbanek at r-project.org  Wed Jul 22 18:02:37 2009
From: simon.urbanek at r-project.org (Simon Urbanek)
Date: Wed, 22 Jul 2009 12:02:37 -0400
Subject: [Rd] Rcmd check fails on Windows Samba network path in R 2.9.1
In-Reply-To: <4A67220C.2040908@stats.uwo.ca>
References: <4A64B36E.8040405@mdacc.tmc.edu>
	<4A64DC8A.6040805@acm.org>	<4A65AC9A.9060808@mdacc.tmc.edu>	<59d7961d0907220146k72738bd4m3c1cd56a77401aa3@mail.gmail.com>
	<4A670FB3.4030802@mdacc.tmc.edu> <4A67220C.2040908@stats.uwo.ca>
Message-ID: <A3946251-8DC4-4780-BD07-4BDE3EC26C41@r-project.org>


On Jul 22, 2009, at 10:28 , Duncan Murdoch wrote:

> On 7/22/2009 9:10 AM, Kevin R. Coombes wrote:
>> Hi,
>> Thanks; that confirms that the problem originates where I thought  
>> it did, and provides a fix from within R.
>> However, the original problem was that running "Rcmd check" from a  
>> Windows/DOS command prompt on a package on a mounted Samba network  
>> drive fails.  The failure occurs because of the file.access call in  
>> "install.R", which appears to get incorrect information from the  
>> operating system.  Is it possible to get install.R changed so it  
>> works in this situation?
>
>
> Of course that's possible, but I'd put it at a low priority.  The  
> right solution here is to fix Samba.  A simple workaround is to copy  
> the package to a non-Samba drive.  Since this is not our bug, and it  
> has a simple workaround, I don't want to put an effort into fixing it.
>

It *is* our bug - this happens on other drives, too, not just samba  
(see my "R CMD check failing due to unreliable file.access() on  
Windows" post from 7/2 on R-core about this) - hence your advice is  
quite far off. Also note that other tools have no issue finding the  
correct flags. I thought this is being worked on (according to that  
thread)... I'm not saying that file.access() can be fixed easily  
(essentially you have to deal with GetFileSecurityW returning  
ERROR_NOT_SUPPORTED and use the GetFileAttributesW result or something  
similar instead), but check surely can use the same old reality-based  
check that it used before 2.9.0.

Cheers,
Simon



> Duncan Murdoch
>
>> (Under the philosophy that "it is easier to beg forgiveness than to  
>> ask permission", perhaps install R should just try to create/write  
>> what it wants and only fail iby checking the result rather than  
>> 'asking permission"....)
>> Best,
>>    Kevin
>> Henrik Bengtsson wrote:
>>> See r-devel thread '[Rd] file.access() on network (mounted) drive on
>>> Windows Vista' on Nov 26, 2008:
>>>
>>>  http://tolstoy.newcastle.edu.au/R/e5/devel/08/11/0806.html
>>>
>>> where it was concluded that file.access() is "not 100%", e.g.
>>> file.access() and file.info() can give different answers.
>>>
>>> I added fileAccess(..., safe=TRUE) to R.utils, which imitates
>>> file.access() but relies also on file.info() and file.exists() to
>>> infer the rights.  It is still not 100% but (hopefully) closer than
>>> file.access().
>>>
>>> /H
>>>
>>> On Tue, Jul 21, 2009 at 1:55 PM, Kevin R.
>>> Coombes<krcoombes at mdacc.tmc.edu> wrote:
>>>
>>>> Hi,
>>>>
>>>> The problem almost certainly has something to do with Samba.  We  
>>>> also have a
>>>> NetApp file system, and copying the package source to that drive  
>>>> and running
>>>> Rcmd check from Windows works just fine.
>>>>
>>>> When running the commands from an interactive R session,  
>>>> file_test returns
>>>> TRUE and file.access to test write permission indicates a  
>>>> failure, even
>>>> though that information is incorrect.Here is a session transcript:
>>>>
>>>> -----------------------------------------
>>>>
>>>>> getwd()
>>>>>
>>>> [1] "n:/krc/Umpire/R-Package"
>>>>
>>>>> lib <- "Umpire.Rcheck"
>>>>> file_test("-d", lib)
>>>>>
>>>> [1] TRUE
>>>>
>>>>> file.access(lib, 2)
>>>>>
>>>> Umpire.Rcheck
>>>>         -1
>>>>
>>>>> dir.create(paste(lib, "testdir", sep='/'))
>>>>> dir(lib)
>>>>>
>>>> [1] "00check.log"   "00install.out" "testdir"     > sessionInfo()
>>>> R version 2.9.1 (2009-06-26)
>>>> i386-pc-mingw32
>>>>
>>>> locale:
>>>> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United
>>>> States.1252;LC_MONETARY=English_United
>>>> States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
>>>>
>>>> attached base packages:
>>>> [1] stats     graphics  grDevices utils     datasets  methods    
>>>> base
>>>> ----------------------------------------
>>>> Again, this all worked (and still works) correctly in 2.8.1.
>>>>
>>>>  Kevin
>>>>
>>>> Tony Plate wrote:
>>>>
>>>>> This error message looks like it comes from src/library/tools/R/ 
>>>>> install.R,
>>>>> which contains the following test:
>>>>>
>>>>>  if (!.file_test("-d", lib) || file.access(lib, 2L))
>>>>>      stop("ERROR: no permission to install to directory ",
>>>>>           sQuote(lib), call. = FALSE)
>>>>>
>>>>> The function .file_test() is defined earlier in the same file  
>>>>> (it looks at
>>>>> file.info(lib)$isdir) and appears to be intended to be the same as
>>>>> utils:::file_test().
>>>>>
>>>>> You could start trying to figure out what the problem is by  
>>>>> trying these
>>>>> calls on the directory in question from an interactive R session.
>>>>> (They seem to work as intended on my Windows system with a  
>>>>> NetApp file
>>>>> system mounted on a letter drive.)
>>>>>
>>>>> -- Tony Plate
>>>>>
>>>>> Kevin R. Coombes wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I have just updated R from version 2.8.1 to version 2.9.1.  I  
>>>>>> am running
>>>>>> Windows XP Professional, Service Pack 3.
>>>>>>
>>>>>> With the update, I decided to update a set of packages that I  
>>>>>> maintain by
>>>>>> compiling them for the new version.  Everything worked fine  
>>>>>> except for one
>>>>>> package.  This package is unique (among the six I was working  
>>>>>> on) in that is
>>>>>> stored on a UNIX-based file server that is exported to the  
>>>>>> Windows network
>>>>>> via Samba.  The root of that network path is mapped to drive  
>>>>>> "N:" on the
>>>>>> local machine.
>>>>>>
>>>>>> 'Rcmd check' fails for this package under 2.9.1.  The error  
>>>>>> message in
>>>>>> '00install.out'  is:
>>>>>> "Error: ERROR: no permission to install to directory
>>>>>> 'N:/krc/Umpire/R-Package/Umpire.Rcheck'"
>>>>>>
>>>>>> 'Rcmd check' works for this package under 2.8.1.
>>>>>>
>>>>>> 'Rcmd check' works for this package if the directory is copied  
>>>>>> onto a
>>>>>> local hard drive instead of the network drive.
>>>>>>
>>>>>> 'Rcmd build' and 'Rcmd build --binary' work under both versions.
>>>>>>
>>>>>> It would be nice if someone could figure out what has changed  
>>>>>> and fix
>>>>>> it....
>>>>>>
>>>>>> Best,
>>>>>>  Kevin Coombes
>>>>>>
>>>>>> ______________________________________________
>>>>>> R-devel at r-project.org mailing list
>>>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>>>
>>>>>>
>>>> ______________________________________________
>>>> R-devel at r-project.org mailing list
>>>> https://stat.ethz.ch/mailman/listinfo/r-devel
>>>>
>>>>
>> ______________________________________________
>> R-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-devel
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
>



[Rd] Rcmd check fails on Windows Samba network path in R 2.9.1
Simon Urbanek