Re: [Rd] Fixing the HDF5 package: the on.exit mystery

From: H C Pumphrey <H.C.Pumphrey_at_ed.ac.uk>
Date: Tue, 15 Mar 2011 16:55:23 +0000

H C Pumphrey wrote:

> I'm trying to fix a subtle bug in the hdf5 package. This package
> provides an interfaces to the HDF5 library and hence allows one to load
> data into R from files in the HDF5 format. The bug appeared during a
> period in which R changed but the package did not. [details snipped]

I considered Prof. Ripley's suggestion to use finalizers but I'm not a good enough C programmer and rapidly became bogged down. For the moment I have fixed the bug in a more crude and obvious manner, by putting the relevant clean-up code at the end of both hdf5save() and hdf5load() and removing all references to the on.exit mechanism. This now means that if things work properly you can open and close as many HDF5 files as you like. (I imagine that the downside is that your file may be left open if some sorts of errors occur. But I think this was probably happening anyway, given the fact that the on.exit mechanism wasn't working. )

I have also altered the code behind hdf5load() so that it ignores soft links inside a HDF5 file that don't have a target. Ideally your file should not contain such things. But if it does, then it is better to skirt round them than to fail whenever you meet one.

I will try uploading the package to CRAN at some point, but I think I'll use it myself for a bit to see whether it has any other nasties. If anyone wants to try it in the meantime you can get it at http://xweb.geos.ed.ac.uk/~hcp (scroll down to the bottom). I'd be particularly interested to know if it can be built on Windows/MacOS and, if not, why not.

Hugh

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

______________________________________________
R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Received on Wed 16 Mar 2011 - 08:15:46 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 18 Mar 2011 - 18:00:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive