Re: [Rd] source() chdir does not work (PR#7940)

From: <ripley_at_stats.ox.ac.uk>
Date: Wed 15 Jun 2005 - 10:51:45 GMT


This is already fixed:

     o	source(file, chdir = TRUE) was not checking that 'file' was a
 	filepath (rather than a URL).  For 2.1.0 only, it did not work
 	even if 'file' was a filepath.

>From the R FAQ:

    Before you actually submit a bug report, you should check whether the bug has already been reported and/or fixed. First, try the "Search Existing Reports" facility in the Bug Tracking page at `http://bugs.R-project.org/'. Second, consult `https://svn.R-project.org/R/trunk/NEWS', which records changes that will appear in the _next_ release of R, including some bug fixes that do not appear in Bug Tracking. (Windows users should additionally consult `https://svn.R-project.org/R/trunk/src/gnuwin32/CHANGES'.) Third, if possible try the current r-patched or r-devel version of R. If a bug has already been reported or fixed,

please do not submit further bug reports on it.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

On Wed, 15 Jun 2005 agalakhov@ifmlrs.uran.ru wrote:

> Full_Name: Alex Galakhov
> Version: 2.1.0
> OS: Linux (Debian)
> Submission from: (NULL) (195.19.131.68)
>
>
> After software upgrade source() does not work properly anymore. It completely
> ignores the chdir= parameter. This is because is.character(file) is always false
> after the assignment file<-file(file).
>
> The fix is (written by hand in diff-like syntax, hopefully, you'll understand
> it):
>
> source<- function (blablabla) {
> +filename <- file
> ...blablabla
> -if (chdir && is.character (file) && ... dirname(file) ...) {
> +if (chdir && is.character (filename) && ... dirname(filename) ...) {
> +close(file) # since we can have only one on.exit(), we close file here
> ...blablabla
> on.exit(setwd(owd));
> }

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed Jun 15 20:54:07 2005

This archive was generated by hypermail 2.1.8 : Mon 24 Oct 2005 - 22:27:19 GMT