From: Uwe L. <li...@st...> - 2007-09-18 13:34:17
|
gg...@us... wrote: > Revision: 66 > http://bugs-r.svn.sourceforge.net/bugs-r/?rev=66&view=rev > Author: ggorjan > Date: 2007-09-18 06:17:39 -0700 (Tue, 18 Sep 2007) > > Log Message: > ----------- > two minor tweaks for S-PLUS on Linux/UNIX > > Modified Paths: > -------------- > trunk/R2WinBUGS/R/bugs.R > trunk/R2WinBUGS/R/bugs.run.R > > Modified: trunk/R2WinBUGS/R/bugs.R > =================================================================== > --- trunk/R2WinBUGS/R/bugs.R 2007-09-17 09:18:14 UTC (rev 65) > +++ trunk/R2WinBUGS/R/bugs.R 2007-09-18 13:17:39 UTC (rev 66) > @@ -37,15 +37,15 @@ > on.exit(setwd(savedWD)) > } > if(is.function(model.file)){ > - temp <- > - if(is.R()){ > - paste(tempfile("model"), "txt", sep=".") > - } else { > - gsub(".tmp$", ".txt", tempfile("model")) > - } > - write.model(model.file, con = temp) > + temp <- > + ifelse(is.R(), > + paste(tempfile("model"), "txt", sep="."), > + ifelse(.Platform$OS.type != "unix", Thank you for the update! Unfortunately, this are inappropriate usages of ifelse(): We know that we are working with a length 1 logical vectors here. Using ifelse() is more insecure and inefficient in such a case! I'll change that myself to if(){} else{}. > + gsub(".tmp$", ".txt", tempfile("model")), > + paste(tempfile("model"), "txt", sep="."))) > + write.model(model.file, con=temp) > model.file <- gsub("\\\\", "/", temp) > - if(!is.R()) on.exit(file.remove(model.file), add = TRUE) > + if(!is.R()) on.exit(file.remove(model.file), add=TRUE) > } > if(!file.exists(model.file)) > stop(paste(model.file, "does not exist.")) > > Modified: trunk/R2WinBUGS/R/bugs.run.R > =================================================================== > --- trunk/R2WinBUGS/R/bugs.run.R 2007-09-17 09:18:14 UTC (rev 65) > +++ trunk/R2WinBUGS/R/bugs.run.R 2007-09-18 13:17:39 UTC (rev 66) > @@ -9,7 +9,7 @@ > > ## Is bugs.directory defined in Windows (where second character is : > ## i.e. C:\Program...) or Unix style path? > - if(useWINE && (substr(bugs.directory, start=2, stop=2) == ":")) { > + if(useWINE && (substr(bugs.directory, 2, 2) == ":")) { Is there a good reason for making this code less secure? Uwe > bugs.directory <- win2native(bugs.directory, newWINE=newWINE, WINEPATH=WINEPATH) > } > > > > This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Bugs-r-devel mailing list > Bug...@li... > https://lists.sourceforge.net/lists/listinfo/bugs-r-devel |