From chuck at sharpsteen.net  Thu Apr  7 22:59:02 2011
From: chuck at sharpsteen.net (Sharpie)
Date: Thu, 7 Apr 2011 13:59:02 -0700 (PDT)
Subject: [Rd] R 2.13.0-beta for Windows,
 file.copy() throws suspicious errors due to default value of
 copy.mode
Message-ID: <1302209942002-3434559.post@n4.nabble.com>

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
--
View this message in context: http://r.789695.n4.nabble.com/R-2-13-0-beta-for-Windows-file-copy-throws-suspicious-errors-due-to-default-value-of-copy-mode-tp3434559p3434559.html
Sent from the R devel mailing list archive at Nabble.com.



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