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

From: Yihui Xie <xie_at_yihui.name>
Date: Sat, 23 Apr 2011 11:36:01 -0500

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/')

Error in Sys.chmod(to[okay], file.info(from[okay])$mode, TRUE) :   'mode' must be of length at least one
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
Received on Sat 23 Apr 2011 - 16:42:47 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 Sun 24 Apr 2011 - 19:10:51 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