Hdfview should default to read-only open


I ran hdfview like so…

/path/HDFView-3.0.0-Linux/HDFView/3.0.0/hdfview.sh myfile.h5

Its a 1.5 GB file with a ton of directories and objects in it.

hdfview OOM’d. That is bad. Worse, it corrupted the file.

When a file is given on the command-line, I think it should default to opening that file read-only. In addition, if data corruption is a potential issue with hdfview, then I would recommend that ‘open’ in the GUI means read-only and a separate open-for-write be provided.

I think the default open for writing is too risk, particularly given this experience.


Yes, next release defaults to read-only mode.


Maybe the headline of this thread should be changed to all HDF5 tools should default to read-only open. I just tried using h5ls on a file that I was already looking at in hdfview and h5ls failed with error “unable to open file”. I suspect this is because the file may already have been corrupted by hdfview. But, I was using hdfview and h5ls from 1.10.2 install.

And, it just seems prudent that all HDF5 tools should open files read-only and users should have to take action (with cl args or something) if they want read-write.


Hi Mark,

The h5ls (or h5dump) utility does not appear to modify an HDF5 file.

The beta version of HDFView 3.0 did modify an HDF5 by default. As of the released version of HDFView 3.0 (that uses HDF5-1.10.3) we changed the behavior so that an HDF5 file is not modified by default, and you can change the default way files are opened by selecting User Options from the Tools menu at the top of the HDFView window. (HOWEVER, if you had the HDFView 3.0 beta installed previously, the default will be read-write, because the HDFView 3.0 options file (.hdfviewx) is already there (unless you delete it first).

If you are on Windows, you will get an “unable to open file” error if you have a file opened in HDFView, and you try running h5ls on the file. Windows only allows one file to be open at a time. The timestamp will also appear to be modified, but when HDFView closes the file, the timestamp on the file will revert back to the original timestamp.

On Unix, you should be able to open the file in HDFView and use h5ls at the same time.



Ok, well, the problem with h5ls opening the file then must have been that hdfview had already corrupted it. Which is strange because hdfview seemed to continue to work on the file just fine :wink:

The mode of operation you describe for these tools is, IMHO, the preferred one.