[Rd] R::Rdconv Rdconv() does not close input file handle (PR#9126)
ripley at stats.ox.ac.uk
ripley at stats.ox.ac.uk
Sun Aug 6 16:38:55 CEST 2006
Bill,
Thanks for the report. It looks like the mail system has mangled the
patches, but I have applied them manually to 2.3.1 patched and R-devel.
Brian
On Sat, 5 Aug 2006, bill at insightful.com wrote:
> Full_Name: Bill Dunlap
> Version: 2.3.0
> OS: Windows XP
> Submission from: (NULL) (71.121.183.214)
>
>
> If you had an Rd file called "file.Rd"
> and write a perl script containing
> print "Before Rdconv: " ; system "/usr/sbin/lsof | grep $USER | grep Rd";
> Rdconv("file.Rd", "", "example, "../R-ex/file.R");
> print "After Rdconv: " ; system "/usr/sbin/lsof | grep $USER | grep Rd";
> you will see that file.Rd is still open after Rdconv
> returns. This messed up perl script on Windows
> where I tried to remove the directory containing
> the *.R files after processing them and I could
> not remove it because the last file processed was
> still open.
>
> Making the following change to RHOME/share/perl/R/Rdconv.pm
> seems to fix it.
>
> 77,78c77,82
> < open(rdfile, "<$Rdname") or die "Rdconv(): Couldn't open '$Rdname':
> $!\n";
> <
> ---
> > open(my $rdfile, "<$Rdname") or die "Rdconv(): Couldn't open '$Rdfile':
> $!\n";
> > # Before we added the 'my $' in front of rdfile,
> > # rdfile was not getting closed. Now it will close
> > # when $rdfile goes out of scope. (We could have added
> > # a close rdfile at the end of the while(<rdfile>), but
> > # scoping method is more reliable.
> 123c127
> < while(<rdfile>){
> ---
> > while(<$rdfile>){
>
> -Bill
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at 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
More information about the R-devel
mailing list