Skip to content

Lack of consistent cross-platform behaviour of tools:::buildVignettes()

2 messages · Hervé Pagès

#
Hi,

On both Unix and Windows there is a mechanism to add variables
to the environment when R is started. I noticed that, on Unix,
this mechanism is not used when R is started normally at the
command line but only when it's started using the 'R CMD' syntax.
One problem with this is some lack of consistent cross-platform
behaviour. For example:

On Linux:

   $ echo $TEXINPUTS

   $ echo "Sys.getenv('TEXINPUTS')" | R --slave
   TEXINPUTS
          ""
But on Windows:

   E:\tmp>echo %TEXINPUTS%
   %TEXINPUTS%
   E:\tmp>echo Sys.getenv("TEXINPUTS") | R\bin\R.exe --slave
                                               TEXINPUTS
   ".;;E:/biocbld/bbs-2.7-bioc/R/share/texmf/tex/latex;"

So on Linux if I cd to the inst/doc folder of a package source tree
that has a Makefile and run

   echo "tools:::buildVignettes('pkgname', '.')" | R --slave

it fails with error:

   ! LaTeX Error: File `Sweave.sty' not found.

while doing the same thing on Windows works.

Is there any reason for not setting the environments variables
that are defined in ${R_HOME}/bin/Rcmd (the shell script wrapper
for all R CMD commands) when R is started normally?

Thanks,
H.

BTW, I found this (on both, Unix and Windows):

   $ echo "Sys.getenv('TEXINPUTS')" | R
   Fatal error: you must specify '--save', '--no-save' or '--vanilla'

What about --slave? Thanks!
9 days later
#
Hi,

In current R-alpha (r52991), consistent cross-platform behavior
has been restored, thanks!
That is, on both Unix and Windows, ${R_HOME}/bin/R doesn't add
variables to the environment, but ${R_HOME}/bin/R CMD does.

Is there any reason why ${R_HOME}/bin/R couldn't add those variables
to the environment too (on both platforms of course) so the code
in the examples and vignettes that is run during R CMD check
sees the same environment as if run interactively?

The example I gave below with buildVignettes() is a situation where
it runs fine if run by 'R CMD check' but fails if run interactively.

Thanks!
H.
On 09/15/2010 09:54 PM, Herv? Pag?s wrote: