[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CDY-638973]: Bug in NetCDF library



> Dear Unidata,
> 
> I have been using the NetCDF library for some time now to create and read 
> classic format files. However, recently I found the need to use the new 
> 64-bit offset format to store large datasets. The problem is that, in the C++ 
> interface to the library, there is a bug that prevents the creation of 
> anything else but classic files. Though I'm using version 3.6.0-p1, I've 
> found that the problem continues to exist in the latest release (3.6.2).
> 
> The responsible code is located in the NcFile::NcFile(...) constructor:
> 
> NcFile::NcFile( const char* path, FileMode fmode, size_t* chunksizeptr, 
> size_t initialsize, FileFormat fformat  )
> {
> NcError err(NcError::silent_nonfatal); // constructor must not fail
> 
> int mode = NC_NOWRITE;
> the_fill_mode = Fill;
> int status;
> 
> // If the user wants a 64-bit offset format, set that flag.
> if (fformat == Offset64Bits)
> mode |= NC_64BIT_OFFSET;
> 
> switch (fmode) {
> case Write:
> mode = NC_WRITE;
> /*FALLTHRU*/
> case ReadOnly:
> [...]
> 
> As you can see, when the file format is requested to use 64-bit offsets, the 
> mode variable is set appropriately but then, when the switch-case is entered 
> next, the mode variable is overwritten with whatever file mode selected. This 
> prevents the 64-bit format flag to ever reach the actual creation of the 
> NetCDF file, so it is always created with the classic format.
> 
> Do you think this could be fixed by then next release? An easy solution would 
> be to move the 64-bit flag setting before the FALLTHRU comments in the 
> switch-case... In any case, thanks for the great work you have performed by 
> creating and supporting this library.
> 
> Kind regards.
> 
> ________________________________
> 

Thanks for pointing this out! I have fixed this, and the fix is in the latest 
netCDF-3 snapshot:
http://www.unidata.ucar.edu/software/netcdf/builds/snapshot/

I have also modified the C++ test so that it checks the format of the test file.

Thanks again!

Ed
> 
> Oscar Portela Arjona
> 
> Ingeniero Inform�tico /
> 
> Software Engineer
> 
> 
> 
> 
> GMV AEROSPACE
> AND DEFENCE, S.A.
> Isaac Newton, 11
> P.T.M. Tres Cantos
> E-28760 Madrid
> Tel. +34 91 807 21 00
> Fax +34 91 807 21 99
> www.gmv.com
> 
> 
> 
> ______________________
> Este mensaje, y en su caso, cualquier fichero anexo al mismo,
> puede contener informacion clasificada por su emisor como confidencial
> en el marco de su Sistema de Gestion de Seguridad de la
> Informacion siendo para uso exclusivo del destinatario, quedando
> prohibida su divulgacion copia o distribucion a terceros sin la
> autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
> erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
> Gracias por su colaboracion.
> ______________________
> This message including any attachments may contain confidential
> information, according to our Information Security Management System,
> and intended solely for a specific individual to whom they are addressed.
> Any unauthorised copy, disclosure or distribution of this message
> is strictly forbidden. If you have received this transmission in error,
> please notify the sender immediately and delete it.
> ______________________
> 
> 


Ticket Details
===================
Ticket ID: CDY-638973
Department: Support netCDF
Priority: Urgent
Status: Closed