Bug#861736: closed by Andreas Tille (Bug#861736: fixed in nexus 4.3.2-svn1921-5)
Control: tags -1 + patch Hi, On Fri, 12 May 2017 08:32:28 +0200 Marc Rosanes wrote: > Hi, > > We have found that python-nxs is still affected by problems: > > The following piece of code fails on stretch + the lastest nexus from > unstable: > > ``` > import nxs > f = nxs.open("/tmp/foo.h5", "w5") > f.makegroup('entry', 'NXentry') > f.opengroup('entry') > f.makegroup('g', 'NXcollection') > f.opengroup('g', 'NXcollection') > f.makedata('d', 'float64', shape=(1,)) > f.opendata('d') > f.putdata(1.23) > f.closedata() > f.closegroup() > f.flush() > f.close() > ``` > > > It fails with the exception: > > ``` > Traceback (most recent call last): >File "nxs_flush_bug.py", line 12, in > f.flush() >File "/usr/lib/python2.7/dist-packages/nxs/napi.py", line 397, in flush > raise NeXusError, "Could not flush NeXus file %s"%(self.filename) > nxs.napi.NeXusError: Could not flush NeXus file /tmp/foo.h5 > ``` > > > The same code works correctly on a clean jessie docker. > > This ticket should be reopened, till this issue is solved. > > > > > On 05/11/2017 11:12 AM, Debian Bug Tracking System wrote: > > This is an automatic notification regarding your Bug report > > which was filed against the python-nxs package: > > > > #861736: python-nxs: Cannot save files with nxs python module > > > > It has been closed by Andreas Tille . > > > > Their explanation is attached below along with your original report. > > If this explanation is unsatisfactory and you have not received a > > better one in a separate message then please contact Andreas Tille > > by > > replying to this email. New patch proposal attached. It fixes #866925 as well. Thanks, _g. diff -Nru nexus-4.3.2-svn1921/debian/changelog nexus-4.3.2-svn1921/debian/changelog --- nexus-4.3.2-svn1921/debian/changelog2017-05-11 09:23:17.0 +0200 +++ nexus-4.3.2-svn1921/debian/changelog2017-10-11 19:15:12.0 +0200 @@ -1,3 +1,12 @@ +nexus (4.3.2-svn1921-5.1) UNRELEASED; urgency=medium + + * Non-maintainer upload. + * debian/control: switch B-D from libhdf4g-dev to libhdf4-dev (closes: +#866925) + * Fix patch hdf5-1.10-support.patch (closes: #861736) + + -- Gilles Filippini Wed, 11 Oct 2017 19:15:12 +0200 + nexus (4.3.2-svn1921-5) unstable; urgency=medium * Team upload. diff -Nru nexus-4.3.2-svn1921/debian/control nexus-4.3.2-svn1921/debian/control --- nexus-4.3.2-svn1921/debian/control 2017-05-11 09:23:17.0 +0200 +++ nexus-4.3.2-svn1921/debian/control 2017-10-11 19:15:10.0 +0200 @@ -8,7 +8,7 @@ debhelper (>= 7), default-jdk | java2-sdk, dh-python, - libhdf4g-dev, + libhdf4-dev, libhdf5-dev, libmxml-dev, libtool, diff -Nru nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch --- nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch 2017-05-11 09:23:17.0 +0200 +++ nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch 2017-10-11 19:15:12.0 +0200 @@ -1,11 +1,16 @@ Description: HDF5 1.10.x uses 64 bit handles. They're not int anymore. Author: Gilles Filippini Bug-Debian: https://bugs.debian.org/861736 -Index: nexus-4.3.2-svn1921/src/napi5.c +Index: nexus/src/napi5.c === nexus-4.3.2-svn1921.orig/src/napi5.c -+++ nexus-4.3.2-svn1921/src/napi5.c -@@ -54,12 +54,12 @@ extern void *NXpData; +--- nexus.orig/src/napi5.c nexus/src/napi5.c +@@ -50,16 +50,16 @@ extern void *NXpData; + typedef struct __NexusFile5 { + struct iStack5 { + char irefn[1024]; +- int iVref; ++ hid_t iVref; hsize_t iCurrentIDX; } iStack5[NXMAXSTACK]; struct iStack5 iAtt5; signature.asc Description: OpenPGP digital signature
Bug#861736: closed by Andreas Tille (Bug#861736: fixed in nexus 4.3.2-svn1921-5)
Hi, We have found that python-nxs is still affected by problems: The following piece of code fails on stretch + the lastest nexus from unstable: ``` import nxs f = nxs.open("/tmp/foo.h5", "w5") f.makegroup('entry', 'NXentry') f.opengroup('entry') f.makegroup('g', 'NXcollection') f.opengroup('g', 'NXcollection') f.makedata('d', 'float64', shape=(1,)) f.opendata('d') f.putdata(1.23) f.closedata() f.closegroup() f.flush() f.close() ``` It fails with the exception: ``` Traceback (most recent call last): File "nxs_flush_bug.py", line 12, in f.flush() File "/usr/lib/python2.7/dist-packages/nxs/napi.py", line 397, in flush raise NeXusError, "Could not flush NeXus file %s"%(self.filename) nxs.napi.NeXusError: Could not flush NeXus file /tmp/foo.h5 ``` The same code works correctly on a clean jessie docker. This ticket should be reopened, till this issue is solved. On 05/11/2017 11:12 AM, Debian Bug Tracking System wrote: This is an automatic notification regarding your Bug report which was filed against the python-nxs package: #861736: python-nxs: Cannot save files with nxs python module It has been closed by Andreas Tille . Their explanation is attached below along with your original report. If this explanation is unsatisfactory and you have not received a better one in a separate message then please contact Andreas Tille by replying to this email. -- Marc Rosanes Siscart Computing & Control Division CELLS – ALBA ALBA Synchrotron Light Facility Carrer de la Llum 2-26 08290 Cerdanyola del Vallès, Barcelona (SPAIN) Tel: +34 93 592 40 41 Fax: +34 93 592 43 01 web page: http://www.cells.es/
Bug#861736: Still some regression in python-nxs
Hi, while nexus 4.3.2-svn1921-5 fixes the originally reported exception, the fix seems not to be complete [1]. In order to trigger the still-existing regression, run the following python code (which ideally should exit without errors): ``` import nxs f = nxs.open("/tmp/foo.h5", "w5") f.makegroup('entry', 'NXentry') f.opengroup('entry') f.makegroup('g', 'NXcollection') f.opengroup('g', 'NXcollection') f.makedata('d', 'float64', shape=(1,)) f.opendata('d') f.putdata(1.23) f.closedata() f.closegroup() f.flush() f.close() ``` In stretch + nexus_4.3.2-svn1921-5, it fails with the following exception: ``` Traceback (most recent call last): File "nxs_flush_bug.py", line 12, in f.flush() File "/usr/lib/python2.7/dist-packages/nxs/napi.py", line 397, in flush raise NeXusError, "Could not flush NeXus file %s"%(self.filename) nxs.napi.NeXusError: Could not flush NeXus file /tmp/foo.h5 ``` The same code works well when run on a clean jessie (I used an official debian:stable docker) and it fails with the same exception as above when run on sid (I used the official debian:unstable docker) Cheers, Carlos [1] I am replying here because this new problem seems likely to be related with 861736, but if you think that it may be an unrelated bug I'd be glad to open a new bug
Bug#861736:
here the error message ~/Debian/nexus/bugs$ ./bug.py Traceback (most recent call last): File "./bug.py", line 15, in f.flush() File "/usr/lib/python2.7/dist-packages/nxs/napi.py", line 397, in flush raise NeXusError, "Could not flush NeXus file %s"%(self.filename) nxs.napi.NeXusError: Could not flush NeXus file /tmp/foo.h5
Bug#861736:
It seems that the fix is not enought this test failed at the flush import nxs f = nxs.open("/tmp/foo.h5", "w5") f.makegroup('entry', 'NXentry') f.opengroup('entry') f.makegroup('g', 'NXcollection') f.opengroup('g', 'NXcollection') f.makedata('d', 'float64', shape=(1,)) f.opendata('d') f.putdata(1.23) f.closedata() f.closegroup() f.flush() f.close()
Bug#861736:
Control: tags -1 + patch On Mon, 8 May 2017 14:34:31 + PICCA Frederic-Emmanuel wrote: > Here after rebuilding hdf5 in debug mode > > :~/Debian/nexus$ ./bug.py > H5get_libversion(majnum=0xbf8a5b04, minnum=0xbf8a5b08, relnum=0xbf8a5b0c) = > SUCCEED; > H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; > H5open() = SUCCEED; > H5Pcreate(cls=8 (genprop class)) = 18 (genprop list); > H5Pget_cache(plist=18 (genprop list), mdc_nelmts=0xbf8a5af8, > rdcc_nslots=0xbf8a5afc, rdcc_nbytes=0xbf8a5b00, rdcc_w0=0xbf8a5b10) = SUCCEED; > H5Pset_cache(plist=18 (genprop list), mdc_nelmts=0, rdcc_nslots=521, > rdcc_nbytes=1024000, rdcc_w0=0.75) = SUCCEED; > H5Pset_fclose_degree(plist=18 (genprop list), degree=H5F_CLOSE_STRONG) = > SUCCEED; > H5check_version(majnum=1, minnum=10, relnum=0) = SUCCEED; > H5open() = SUCCEED; > H5Fcreate(filename=0x82517ef8, flags=2, fcpl=H5P_DEFAULT, fapl=18 (genprop > list)) = 0 (file); > H5Pclose(plist=18 (genprop list)) = SUCCEED; > ERROR: cannot open file: filenamenxs.h5 > Traceback (most recent call last): > File "./bug.py", line 5, in > e.save("filenamenxs.h5", 'w5') > File "/usr/lib/python2.7/dist-packages/nxs/tree.py", line 868, in save > file = NeXusTree(filename, format) > File "/usr/lib/python2.7/dist-packages/nxs/napi.py", line 320, in __init__ > raise NeXusError, "Could not %s %s"%(op,filename) This error and others are caused by HDF5 handles being stored as int instead of hid_t. This type changed from int to int64_t with release 1.10.0 of HDF5. Please find attached a patch proposal. Thanks, _g. diff -Nru nexus-4.3.2-svn1921/debian/changelog nexus-4.3.2-svn1921/debian/changelog --- nexus-4.3.2-svn1921/debian/changelog2016-07-22 23:05:27.0 +0200 +++ nexus-4.3.2-svn1921/debian/changelog2017-05-09 19:49:46.0 +0200 @@ -1,3 +1,11 @@ +nexus (4.3.2-svn1921-5) UNRELEASED; urgency=medium + + * QA upload. + * New patch hdf5-1.10-support.patch to fix incorrect type for HDF5 +handles: should be hid_t instead of int (closes: #861736) + + -- Gilles Filippini Tue, 09 May 2017 19:49:46 +0200 + nexus (4.3.2-svn1921-4) unstable; urgency=medium * QA upload. diff -Nru nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch --- nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch 1970-01-01 01:00:00.0 +0100 +++ nexus-4.3.2-svn1921/debian/patches/hdf5-1.10-support.patch 2017-05-09 19:49:46.0 +0200 @@ -0,0 +1,111 @@ +Description: HDF5 1.10.x uses 64 bit handles. They're not int anymore. +Author: Gilles Filippini +Bug-Debian: https://bugs.debian.org/861736 +Index: nexus-4.3.2-svn1921/src/napi5.c +=== +--- nexus-4.3.2-svn1921.orig/src/napi5.c nexus-4.3.2-svn1921/src/napi5.c +@@ -54,12 +54,12 @@ extern void *NXpData; + hsize_t iCurrentIDX; + } iStack5[NXMAXSTACK]; + struct iStack5 iAtt5; +-int iFID; +-int iCurrentG; +-int iCurrentD; +-int iCurrentS; +-int iCurrentT; +-int iCurrentA; ++hid_t iFID; ++hid_t iCurrentG; ++hid_t iCurrentD; ++hid_t iCurrentS; ++hid_t iCurrentT; ++hid_t iCurrentA; + int iNX; + int iNXID; + int iStackPtr; +@@ -434,7 +434,7 @@ NXstatus NX5open(CONSTCHAR *filename, N + NXstatus NX5makegroup (NXhandle fid, CONSTCHAR *name, CONSTCHAR *nxclass) + { + pNexusFile5 pFile; +-herr_t iRet; ++hid_t iRet; + hid_t iVID; + hid_t attr1,aid1, aid2; + char pBuffer[1024] = ""; +@@ -487,7 +487,7 @@ NXstatus NX5open(CONSTCHAR *filename, N + + pNexusFile5 pFile; + hid_t attr1, atype; +-herr_t iRet; ++hid_t iRet; + char pBuffer[1024]; + char data[128]; + +@@ -654,7 +654,7 @@ static hid_t nxToHDF5Type(int datatype) + int compress_type, int64_t chunk_size[]) + { + hid_t datatype1, dataspace, iNew; +- herr_t iRet; ++ hid_t iRet; + hid_t type, cparms = -1; + pNexusFile5 pFile; + char pBuffer[256]; +@@ -992,8 +992,8 @@ static hid_t nxToHDF5Type(int datatype) + return NX_OK; + } + /*--*/ +-static int getAttVID(pNexusFile5 pFile){ +- int vid; ++static hid_t getAttVID(pNexusFile5 pFile){ ++ hid_t vid; + if(pFile->iCurrentG == 0 && pFile->iCurrentD == 0){ +/* global attribute */ +vid = H5Gopen(pFile->iFID,"/", H5P_DEFAULT); +@@ -1007,7 +1007,7 @@ static int getAttVID(pNexusFile5 pFile){ + return vid; + } + /*---*/ +-static void killAttVID(pNexusFile5 pFile, int vid){ ++static void killAttVID(pNexusFile5 pFile, hid_t vid){ + if(pFile->iCurrentG == 0 && pFile->iCurrentD == 0){ + H5Gclose(vid); + } +@@ -1021,8 +1
Bug#861736:
Here after rebuilding hdf5 in debug mode :~/Debian/nexus$ ./bug.py H5get_libversion(majnum=0xbf8a5b04, minnum=0xbf8a5b08, relnum=0xbf8a5b0c) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5open() = SUCCEED; H5Pcreate(cls=8 (genprop class)) = 18 (genprop list); H5Pget_cache(plist=18 (genprop list), mdc_nelmts=0xbf8a5af8, rdcc_nslots=0xbf8a5afc, rdcc_nbytes=0xbf8a5b00, rdcc_w0=0xbf8a5b10) = SUCCEED; H5Pset_cache(plist=18 (genprop list), mdc_nelmts=0, rdcc_nslots=521, rdcc_nbytes=1024000, rdcc_w0=0.75) = SUCCEED; H5Pset_fclose_degree(plist=18 (genprop list), degree=H5F_CLOSE_STRONG) = SUCCEED; H5check_version(majnum=1, minnum=10, relnum=0) = SUCCEED; H5open() = SUCCEED; H5Fcreate(filename=0x82517ef8, flags=2, fcpl=H5P_DEFAULT, fapl=18 (genprop list)) = 0 (file); H5Pclose(plist=18 (genprop list)) = SUCCEED; ERROR: cannot open file: filenamenxs.h5 Traceback (most recent call last): File "./bug.py", line 5, in e.save("filenamenxs.h5", 'w5') File "/usr/lib/python2.7/dist-packages/nxs/tree.py", line 868, in save file = NeXusTree(filename, format) File "/usr/lib/python2.7/dist-packages/nxs/napi.py", line 320, in __init__ raise NeXusError, "Could not %s %s"%(op,filename) nxs.napi.NeXusError: Could not create filenamenxs.h5 H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a6954, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6898) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a689c, client_data=0xbf8a68a0) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6858) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a685c, client_data=0xbf8a6860) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6858) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a685c, client_data=0xbf8a6860) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6888) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a688c, client_data=0xbf8a6890) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6888) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a688c, client_data=0xbf8a6890) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6888) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a688c, client_data=0xbf8a6890) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6898) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a689c, client_data=0xbf8a68a0) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6868) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a686c, client_data=0xbf8a6870) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6868) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a686c, client_data=0xbf8a6870) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eauto_is_v2(estack=H5P_DEFAULT, is_stack=0xbf8a6868) = SUCCEED; H5Eget_auto2(estack=H5P_DEFAULT, func=0xbf8a686c, client_data=0xbf8a6870) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED; H5Eset_auto2(estack=H5P_DEFAULT, func=NULL, client_data=NULL) = SUCCEED;
Bug#861736:
activating the NXError reporting we got filenamenxs.h5 5 ERROR: cannot open file: filenamenxs.h5 0 and looking for this errormessage, we found it in the napi5.c file NXstatus NX5open(CONSTCHAR *filename, NXaccess am, NXhandle* pHandle) { hid_t attr1,aid1, aid2, iVID; pNexusFile5 pNew = NULL; char pBuffer[512]; char *time_buffer = NULL; char version_nr[10]; unsigned int vers_major, vers_minor, vers_release, am1 ; hid_t fapl = -1; int mdc_nelmts; size_t rdcc_nelmts; size_t rdcc_nbytes; double rdcc_w0; unsigned hdf5_majnum, hdf5_minnum, hdf5_relnum; *pHandle = NULL; if (H5get_libversion(&hdf5_majnum, &hdf5_minnum, &hdf5_relnum) < 0) { NXReportError("ERROR: cannot determine HDF5 library version"); return NX_ERROR; } if (hdf5_majnum == 1 && hdf5_minnum < 8) { NXReportError("ERROR: HDF5 library 1.8.0 or higher required"); return NX_ERROR; } /* mask of any options for now */ am = (NXaccess)(am & NXACCMASK_REMOVEFLAGS); /* turn off the automatic HDF error handling */ H5Eset_auto(H5E_DEFAULT, NULL, NULL); #ifdef USE_FTIME struct timeb timeb_struct; #endif pNew = (pNexusFile5) malloc (sizeof (NexusFile5)); if (!pNew) { NXReportError("ERROR: not enough memory to create file structure"); return NX_ERROR; } memset (pNew, 0, sizeof (NexusFile5)); /* start HDF5 interface */ if (am == NXACC_CREATE5) { fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pget_cache(fapl,&mdc_nelmts,&rdcc_nelmts,&rdcc_nbytes,&rdcc_w0); rdcc_nbytes=(size_t)nx_cacheSize; H5Pset_cache(fapl,mdc_nelmts,rdcc_nelmts,rdcc_nbytes,rdcc_w0); H5Pset_fclose_degree(fapl,H5F_CLOSE_STRONG); am1 = H5F_ACC_TRUNC; pNew->iFID = H5Fcreate (filename, am1, H5P_DEFAULT, fapl); } else { if (am == NXACC_READ) { am1 = H5F_ACC_RDONLY; } else { am1 = H5F_ACC_RDWR; } fapl = H5Pcreate(H5P_FILE_ACCESS); H5Pset_fclose_degree(fapl,H5F_CLOSE_STRONG); pNew->iFID = H5Fopen (filename, am1, fapl); } if(fapl != -1) { H5Pclose(fapl); } if (pNew->iFID <= 0) { sprintf (pBuffer, "ERROR: cannot open file: %s", filename); NXReportError( pBuffer); free (pNew); return NX_ERROR; }
Bug#861736:
Herethe code ofthismethod /**/ static NXstatus NXinternalopen(CONSTCHAR *userfilename, NXaccess am, pFileStack fileStack); /*--*/ NXstatus NXopen(CONSTCHAR *userfilename, NXaccess am, NXhandle *gHandle){ int status; pFileStack fileStack = NULL; *gHandle = NULL; fileStack = makeFileStack(); if(fileStack == NULL){ NXReportError("ERROR: no memory to create filestack"); return NX_ERROR; } status = NXinternalopen(userfilename,am,fileStack); if(status == NX_OK){ *gHandle = fileStack; } return status; so lets's see the internalopen static NXstatus NXinternalopen(CONSTCHAR *userfilename, NXaccess am, pFileStack fileStack) { return LOCKED_CALL(NXinternalopenImpl(userfilename, am, fileStack)); } /*---*/ static NXstatus NXinternalopenImpl(CONSTCHAR *userfilename, NXaccess am, pFileStack fileStack) { int hdf_type=0; int iRet=0; NXhandle hdf5_handle = NULL; pNexusFunction fHandle = NULL; NXstatus retstat = NX_ERROR; char error[1024]; char *filename = NULL; int my_am = (am & NXACCMASK_REMOVEFLAGS); /* configure fortify iFortifyScope = Fortify_EnterScope(); Fortify_CheckAllMemory(); */ /* allocate data */ fHandle = (pNexusFunction)malloc(sizeof(NexusFunction)); if (fHandle == NULL) { NXReportError("ERROR: no memory to create Function structure"); return NX_ERROR; } memset(fHandle, 0, sizeof(NexusFunction)); /* so any functions we miss are NULL */ /* test the strip flag. Elimnate it for the rest of the tests to work */ fHandle->stripFlag = 1; if(am & NXACC_NOSTRIP){ fHandle->stripFlag = 0; am = (NXaccess)(am & ~NXACC_NOSTRIP); } fHandle->checkNameSyntax = 0; if (am & NXACC_CHECKNAMESYNTAX) { fHandle->checkNameSyntax = 1; am = (NXaccess)(am & ~NXACC_CHECKNAMESYNTAX); } if (my_am==NXACC_CREATE) { /* HDF4 will be used ! */ hdf_type=1; filename = strdup(userfilename); } else if (my_am==NXACC_CREATE4) { /* HDF4 will be used ! */ hdf_type=1; filename = strdup(userfilename); } else if (my_am==NXACC_CREATE5) { /* HDF5 will be used ! */ hdf_type=2; filename = strdup(userfilename); } else if (my_am==NXACC_CREATEXML) { /* XML will be used ! */ hdf_type=3; filename = strdup(userfilename); } else { filename = locateNexusFileInPath((char *)userfilename); if(filename == NULL){ NXReportError("Out of memory in NeXus-API"); free(fHandle); return NX_ERROR; } /* check file type hdf4/hdf5/XML for reading */ iRet = determineFileType(filename); if(iRet < 0) { snprintf(error,1023,"failed to open %s for reading", filename); NXReportError(error); free(filename); return NX_ERROR; } if(iRet == 0){ snprintf(error,1023,"failed to determine filetype for %s ", filename); NXReportError(error); free(filename); free(fHandle); return NX_ERROR; } hdf_type = iRet; } if(filename == NULL){ NXReportError("Out of memory in NeXus-API"); return NX_ERROR; } if (hdf_type==1) { /* HDF4 type */ #ifdef HDF4 NXhandle hdf4_handle = NULL; retstat = NX4open((const char *)filename,am,&hdf4_handle); if(retstat != NX_OK){ free(fHandle); free(filename); return retstat; } fHandle->pNexusData=hdf4_handle; NX4assignFunctions(fHandle); pushFileStack(fileStack,fHandle,filename); #else NXReportError( "ERROR: Attempt to create HDF4 file when not linked with HDF4"); retstat = NX_ERROR; #endif /* HDF4 */ free(filename); return retstat; } else if (hdf_type==2) { /* HDF5 type */ #ifdef HDF5 retstat = NX5open(filename,am,&hdf5_handle); if(retstat != NX_OK){ free(fHandle); free(filename); return retstat; } fHandle->pNexusData=hdf5_handle; NX5assignFunctions(fHandle); pushFileStack(fileStack,fHandle, filename); #else NXReportError( "ERROR: Attempt to create HDF5 file when not linked with HDF5"); retstat = NX_ERROR; #endif /* HDF5 */ free(filename); return retstat; } else if(hdf_type == 3){ /* XML type */ #ifdef NXXML NXhandle xmlHandle = NULL; retstat = NXXopen(filename,am,&xmlHandle); if(retstat != NX_OK){ free(fHandle); free(filename); return retstat; } fHandle->pNexusData=xmlHandle; NXXassignFunctions(fHandle); pushFileStack(fileSta
Bug#861736:
in the napi.h files we saw this. define CONCAT(__a,__b) __a##__b/* token concatenation */ #ifdef __VMS #define MANGLE(__arg) __arg #else #define MANGLE(__arg) CONCAT(__arg,_) #endif #define NXopen MANGLE(nxiopen) /** * Open a NeXus file. * NXopen honours full path file names. But it also searches * for files in all the paths given in the NX_LOAD_PATH environment variable. * NX_LOAD_PATH is supposed to hold a list of path string separated by the platform * specific path separator. For unix this is the : , for DOS the ; . Please note * that crashing on an open NeXus file will result in corrupted data. Only after a NXclose * or a NXflush will the data file be valid. * \param filename The name of the file to open * \param access_method The file access method. This can be: * \li NXACC__READ read access * \li NXACC_RDWR read write access * \li NXACC_CREATE, NXACC_CREATE4 create a new HDF-4 NeXus file * \li NXACC_CREATE5 create a new HDF-5 NeXus file * \li NXACC_CREATEXML create an XML NeXus file. * see #NXaccess_mode * Support for HDF-4 is deprecated. * \param pHandle A file handle which will be initialized upon successfull completeion of NXopen. * \return NX_OK on success, NX_ERROR in the case of an error. * \ingroup c_init */ extern NXstatus NXopen(CONSTCHAR * filename, NXaccess access_method, NXhandle* pHandle); so we need to check in this method what is going on.
Bug#861736:
Let's instrument the code print filename, mode, _ref(self.handle) status = nxlib.nxiopen_(filename,mode,_ref(self.handle)) print status $ python bug.py filenamenxs.h5 5 0
Bug#861736:
Hello here the napi code which cause some trouble. # Convert open mode from string to integer and check it is valid if mode in _nxopen_mode: mode = _nxopen_mode[mode] if mode not in _nxopen_mode.values(): raise ValueError, "Invalid open mode %s",str(mode) self.filename, self.mode = filename, mode self.handle = c_void_p(None) self._path = [] self._indata = False status = nxlib.nxiopen_(filename,mode,_ref(self.handle)) if status == ERROR: if mode in [ACC_READ, ACC_RDWR]: op = 'open' else: op = 'create' raise NeXusError, "Could not %s %s"%(op,filename) Soit seems that the nxlib.nxiopen_ method return an error
Bug#861736: python-nxs: Cannot save files with nxs python module
Control: tag -1 + confirmed Control: user debian-rele...@lists.debian.org Control: usertag -1 + bsp-2017-05-ch-zurich Hi, Marc Rosanes wrote: >import nxs >e = nxs.NXentry(name= "NXtomo") >e.save("filenamenxs.h5", 'w5') [...] > /usr/lib/python2.7/dist-packages/nxs/tree.pyc in save(self, > filename, format) > 866 root = NXroot(NXentry(self)) > 867 if root.nxfile: root.nxfile.close() > --> 868 file = NeXusTree(filename, format) > 869 file.writefile(root) > 870 file.close() > > /usr/lib/python2.7/dist-packages/nxs/napi.pyc in __init__(self, > filename, mode) > 318 else: > 319 op = 'create' > --> 320 raise NeXusError, "Could not %s %s"%(op,filename) > 321 self.isopen = True > 322 I can reproduce this on Sid/Stretch, but not on Jessie, so this is a regression from Jessie to Stretch. The same happens if you don't specify the file format (as HDF5 seems to be the default file format). Regards, Axel -- ,''`. | Axel Beckert , http://people.debian.org/~abe/ : :' : | Debian Developer, ftp.ch.debian.org Admin `. `' | 4096R: 2517 B724 C5F6 CA99 5329 6E61 2FF9 CD59 6126 16B5 `-| 1024D: F067 EA27 26B9 C3FC 1486 202E C09E 1D89 9593 0EDE
Bug#861736: Bug on NeXus library
Additional information: Storing using 'w' format (hdf4), instead of using 'w5' format (hdf5); the error does not appear: import nxs e = nxs.NXentry(name= "NXtomo") e.save("filenamenxs.h5",*'**w**'*)
Bug#861736: python-nxs: Cannot save files with nxs python module
Package: python-nxs Version: 4.3.2-svn1921-4 Severity: grave Justification: renders package unusable Dear Maintainer, * What led up to the situation? Run the following python code: import nxs e = nxs.NXentry(name= "NXtomo") e.save("filenamenxs.h5", 'w5') * What was the outcome of this action? Got the following exception: NeXusError Traceback (most recent call last) in () > 1 e.save("filenamenxs.h5", 'w5') /usr/lib/python2.7/dist-packages/nxs/tree.pyc in save(self, filename, format) 866 root = NXroot(NXentry(self)) 867 if root.nxfile: root.nxfile.close() --> 868 file = NeXusTree(filename, format) 869 file.writefile(root) 870 file.close() /usr/lib/python2.7/dist-packages/nxs/napi.pyc in __init__(self, filename, mode) 318 else: 319 op = 'create' --> 320 raise NeXusError, "Could not %s %s"%(op,filename) 321 self.isopen = True 322 * What outcome did you expect instead? An hdf5 file filenamenxs.h5 saved with no exception. Note: Tried this with debian:stable docker and it worked correctly. -- System Information: Debian Release: 9.0 APT prefers testing APT policy: (500, 'testing') Architecture: amd64 (x86_64) Kernel: Linux 4.9.0-1-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Init: systemd (via /run/systemd/system) Versions of packages python-nxs depends on: ii libnexus0v5 4.3.2-svn1921-4+b1 pn python:any python-nxs recommends no packages. python-nxs suggests no packages. -- no debconf information