[Rd] paths and Rook problems only in OSX CRAN binary package?

Simon Urbanek simon.urbanek at r-project.org
Mon Nov 26 15:37:41 CET 2012


Richard,

I was away hence a late response.

The problem is that you are creating aovApp directly at compile time, so it will hard-code the root path as the initialized object is lazy-loaded. This means that the package will only work in the library that it was complied into, it won't work anywhere else and thus it cannot be distributed as a binary package.

There are many possible fixes, probably the easiest is to simply make aovApp a function so the actual objects won't be lazy-loaded:

diff -ru BayesFactor/R/aovRook.R BayesFactor-fix/R/aovRook.R
--- BayesFactor/R/aovRook.R	2012-11-23 16:54:06.000000000 -0500
+++ BayesFactor-fix/R/aovRook.R	2012-11-26 09:32:48.000000000 -0500
@@ -119,7 +119,7 @@
     rookEnv$aov$s <- Rhttpd$new()
     rookEnv$aov$s$start(quiet=TRUE)
     rookEnv$aov$s$add(name="aov",
-          app=aovApp)
+          app=aovApp())
   }
   rookEnv$aov$s$browse("aov")
 }
@@ -262,7 +262,7 @@
   }
 }
 
-aovApp <- Builder$new(
+aovApp <- function() Builder$new(
   Static$new(
     urls = '/www',
     root = system.file('.', package='BayesFactor')


Cheers,
Simon


On Nov 21, 2012, at 3:57 PM, Richard D. Morey wrote:

> Hi everyone,
> 
> I'm trying to diagnose a problem in my R package, but it is a little tricky since it seems to occur only with the Mac OSX CRAN binary build.
> 
> My package starts a Rook server and opens a browser. On my own system (details below), when I build the package, I have no trouble. The Rook server starts and the page loads in the browser. 
> 
> However, if I've installed it from CRAN, I get the following error when trying to open my Rook interface:
> 
> ######
> Warning message:
> In normalizePath(file.path(root, path_info)) :
> 
> path[1]="/Volumes/XT3/Rdev-web/QA/Simon/packages/leopard-universal/Rlib/2.15/BayesFactor/.//www/warning.html":
> No such file or directory
> ######
> 
> I assume "Simon" refers to Simon Urbanek.
>  
> www/warning.html is the file Rook is attempting to open. This looks like a path from the CRAN build machine. How did this make it into my package? I'm sort of baffled, and I don't know how to diagnose it. 
> 
> To replicate:
> #########
> install.packages('BayesFactor')
> library(BayesFactor)
> data(puzzles)
> aovGUI(y = puzzles$RT, dataFixed = puzzles[,3:4], dataRandom = puzzles$ID)
> #########
> 
> When I set 
> options(warning.expression = quote(recover()))
> 
> I see where the problem lies. In the frame "15: file_server$call(env)", the variable "root" is defined as:
> 
> Browse[1]> root
> [1] "/Volumes/XT3/Rdev-web/QA/Simon/packages/leopard-universal/Rlib/2.15/BayesFactor/."
> 
> But "find" returns nothing for "root":
> Browse[1]> find("root")
> character(0)
> 
> In the Rook source here (https://github.com/jeffreyhorner/Rook/blob/master/Rook/R/File.R) is the reference to "root", but I'm not sure where the specific path value comes from.
> 
> Further information:
> > sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> 
> locale:
> [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
> 
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base     
> 
> loaded via a namespace (and not attached):
> [1] tools_2.15.2
> 
> 
> My Rook version is 1.0-8 and I'm running Mountain Lion (10.8.2). Any hints would be appreciated.
> 
> Best,
> Richard
> 
> 



More information about the R-devel mailing list