[Nexus] Re: HDF5 iteration misery

Tim Kelley tkelley at caltech.edu
Thu Oct 2 16:42:07 BST 2003


Hi Sebastian,

I'm not familiar with NXBrowse, but your problem sounds similar to problems
that several of us have had.

The cause of our problem is that the return values from the underlying HDF
library calls ( H5<x>iterate) have changed. Last I heard (July), a message
had been sent to the HDF developers to see if this was a bug or a feature;
any changes in the NAPI code were waiting on this. In the meantime, one
could either use the previous version of HDF5 or change a few lines of the
NAPI source. I'll append part of my July post to this message that descibes
how I hacked napi5.c.

Good luck,
Tim Kelley

------------------------------------
Just a heads-up regarding HDF5. I installed the latest version of the HDF 5
library (1.6.0) and hit some problems running napi5_test.

The problems come from the return value of H5Aiterate and H5GIterate, and
affect NX5getattrinfo, NX5getnextattr and NX5getnextentry. The nexus API
seems to expect them to return 1 while iteration is valid, 0 at the end of
the traversal, and -1 otherwise. However, these functions now seem to skip
the 0 and go straight to -1. The state NX_EOD never seems to be reached;
instead one gets immediately to the state NX_ERROR. This means functions
like NX5getnextattr and NX5getnextentry fail with "ERROR: iteration was not
successful", and NX5getattrinfo goes into infinite loops.

Simple hacks get past this. If one replaces the line in NX5getnextentry( ):

else if (iRet == 0)

with

else if (iRet == 0 || iRet == -1),

and changes a few similar lines in NX5getattrinfo & NX5getnextattr (changing
lines like while(iRet != 0) to while( iRet > 0) eliminates infinite loops),
then napi5_test runs successfully.

=====================================================

----- Original Message -----
From: <nexus-request at anl.gov>
To: <nexus at anl.gov>
Sent: Friday, September 26, 2003 11:00 AM
Subject: NeXus Digest, Vol 4, Issue 3


> Send NeXus mailing list submissions to
> nexus at anl.gov
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://www.neutron.anl.gov/mailman/listinfo/nexus
> or, via email, send a message with subject or body 'help' to
> nexus-request at anl.gov
>
> You can reach the person managing the list at
> nexus-owner at anl.gov
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of NeXus digest..."
>
>
> Today's Topics:
>
>    1. Problems with NeXus 2.0.0 (Sebastian Huber)
>
>
> ----------------------------------------------------------------------
>
> Date: Thu, 25 Sep 2003 23:29:15 +0200
> From: Sebastian Huber <sebastian-huber at web.de>
> To: NeXus at anl.gov
> Subject: [Nexus] Problems with NeXus 2.0.0
> Message-ID: <200309252329.15886.sebastian-huber at web.de>
> Content-Type: text/plain;
>   charset="us-ascii"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Precedence: list
> Message: 1
>
> Hi,
> I installed HDF 5 version 1.6.0 and NeXus 2.0.0 on SuSE 8.2. The test
program
> napi5_test fails due to an infinite loop in NX5getattrinfo:
>
>   NXstatus CALLING_STYLE NX5getattrinfo (NXhandle fid, int *iN)
>   {
>     pNexusFile5 pFile;
>     char *iname = NULL;
>     unsigned int idx;
>     int iRet;
>
>     pFile = NXI5assert (fid);
>     idx=0;
>     if (pFile->iCurrentD == 0 && pFile->iCurrentG == 0) {
>       /*
> global attribute
>       */
>        pFile->iVID=H5Gopen(pFile->iFID,"/");
>        iRet = H5Aiterate(pFile->iVID,&idx,attr_info,&iname);
>        iRet = 1;
>        while (iRet != 0) {
>           iRet = H5Aiterate(pFile->iVID,&idx,attr_info,&iname);
>
>           // This loop never exits, because iRet gets negative after four
>           // iterations.
>
>        }
> [...]
>
> If I create a NeXus file with
>
>   if (NXopen ("NXtest.nx5", NXACC_CREATE5, &fileid) != NX_OK) return 1;
>   if (NXclose (&fileid) != NX_OK) return 1;
>
> and try to read it
>
> ./NXbrowse NXtest.nx5
> NXBrowse 2.0.0. Copyright (C) 2000 R. Osborn, M. Koennecke, P. Klosowski
>     NeXus_version = 2.0.0.
>     file_name = NXtest.nx5
>     HDF5_Version = 1.6.0
>     file_time = 2003-09-25 23:20:08+0100
> ERROR: Iteration was not successful
> NX>
>
> something fails. Is my HDF version to new or what might cause this error?
>
> Ciao
> Sebastian Huber
>
>
>
> ------------------------------
>
> _______________________________________________
> NeXus mailing list
> NeXus at anl.gov
> http://www.neutron.anl.gov/mailman/listinfo/nexus
>
>
> End of NeXus Digest, Vol 4, Issue 3
> ***********************************
>
>
>






More information about the NeXus mailing list