[Rd] R 2.13.0-beta for Windows, file.copy() throws suspicious errors due to default value of copy.mode

Uwe Ligges ligges at statistik.tu-dortmund.de
Sun Apr 24 18:00:50 CEST 2011



On 23.04.2011 18:36, Yihui Xie wrote:
> It seems I can reproduce this error under Windows 7 too; it happens
> when a file is copied to a directory:
>
>> dir.create('abc')
>> file.create('testfile')
> [1] TRUE
>> file.copy('testfile','testfile2')
> [1] TRUE
>> file.copy('testfile','abc/')

You must not use a trailing slash.
file.copy('testfile','abc') should work.



> Error in Sys.chmod(to[okay], file.info(from[okay])$mode, TRUE) :
>    'mode' must be of length at least one

This error message is somewhat misleading and has been analyzed already, 
shortly to be fixed in the sources.

Best wishes,
Uwe




> In addition: Warning message:
> In file.create(to[okay]) :
>    cannot create file 'abc/', reason 'Permission denied'
>> sessionInfo()
> R version 2.13.0 (2011-04-13)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=Chinese (Simplified)_People's Republic of China.936
> [2] LC_CTYPE=Chinese (Simplified)_People's Republic of China.936
> [3] LC_MONETARY=Chinese (Simplified)_People's Republic of China.936
> [4] LC_NUMERIC=C
> [5] LC_TIME=Chinese (Simplified)_People's Republic of China.936
>
> attached base packages:
> [1] tools     stats     graphics  grDevices utils     datasets  methods
> [8] base
>
>
> Regards,
> Yihui
> --
> Yihui Xie<xieyihui at gmail.com>
> Phone: 515-294-2465 Web: http://yihui.name
> Department of Statistics, Iowa State University
> 2215 Snedecor Hall, Ames, IA
>
>
>
> On Thu, Apr 7, 2011 at 3:59 PM, Sharpie<chuck at sharpsteen.net>  wrote:
>> While checking packages against R 2.13.0-beta on Windows, I have run into a
>> few strange error messages related to copying files. The errors all relate
>> to file.copy() and have the form of:
>>
>> Error in Sys.chmod(to[okay], file.info(from[okay])$mode, TRUE) :
>>   'mode' must be of length at least one
>>
>> After half a day of tinkering, the best reproducible example I can come up
>> with involves using Roxygen to generate man files for the tikzDevice:
>>
>> # Install roxygen from CRAN and grab tikzDevice source code
>> R --vanilla --slave -e "install.packages('roxygen')"
>> git clone git://github.com/Sharpie/RTikZDevice.git
>>
>> # Generate documentation, first run succeeds:
>> R --vanilla --slave -e "require(roxygen); roxygenize('RTikZDevice',
>> 'RTikZDevice.build', overwrite = TRUE)"
>>
>> Loading required package: roxygen
>> Loading required package: digest
>> Writing anyMultibyteUTF8Characters to
>> RTikZDevice.copy/man/anyMultibyteUTF8Characters.Rd
>> Warning in parse.name(partitum) :
>>   No name found for the following expression in RTikZDevice/R/cacheMetrics.R
>> line 3:
>>   `NULL . . .'
>> Writing queryMetricsDictionary to
>> RTikZDevice.copy/man/queryMetricsDictionary.Rd
>> ...
>> Writing namespace directives to RTikZDevice.copy/NAMESPACE
>> Merging collate directive with RTikZDevice/DESCRIPTION to
>> RTikZDevice.copy/DESCRIPTION
>>
>> # Try running it again, and it bombs:
>> R --vanilla --slave -e "require(roxygen); roxygenize('RTikZDevice',
>> 'RTikZDevice.build', overwrite = TRUE)"
>>
>> Loading required package: roxygen
>> Loading required package: digest
>> Error in Sys.chmod(to[okay], file.info(from[okay])$mode, TRUE) :
>>   'mode' must be of length at least one
>> Calls: roxygenize ->  copy.dir ->  file.copy ->  Sys.chmod
>> In addition: Warning message:
>> In file.create(to[okay]) :
>>   cannot create file
>> 'RTikZDevice.copy/.git/objects/pack/pack-cc0dd1e2622e87f86f8c5a8e617fbf77e253cea1.idx',
>> reason 'Permission denied'
>> Execution halted
>>
>>
>> If I replace all calls to file.copy(...) in the roxygen package with
>> file.copy(..., copy.mode = FALSE) and reinstall it, then I can regenerate
>> package documentation all day long without errors. I also get no errors when
>> I perform the same task with R 2.12.2 on Windows or R 2.13.0-beta on OS X
>> and Linux.
>>
>> Maybe roxygenize() is abusing file.copy() somehow, but I find the "'mode'
>> must be of length at least one" error suspicious.
>>
>> Any ideas?
>>
>> Using:
>> Windows 7 x86_64
>> R 2.13.0-beta
>> Rtools 2.13
>>
>> -Charlie
>>
>>
>> -----
>> Charlie Sharpsteen
>> Undergraduate-- Environmental Resources Engineering
>> Humboldt State University
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list