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

[netCDF #HNO-635604]: 64bit BE problem in netcdf-4.1.1-rc1



Mathis,

> We stumbled across a problem with netcdf-4.1.1-rc1 on our 64bit BE machine
> (Power6). The symptom was that ncdump showed corrupted dimensions for
> perfectly normal netcdf4 files. ncdump linked with netcdf-4.0.1 was okay.
> 
> In 4.1 you changed the type of len in struct NC_DIM_INFO from int to
> size_t. This creates problems with sscanf in read_scale() on our machine. I
> attached a patch to fix this.

Before applying your patch, running on a 64bit BE machine and building zlib,
hdf5-1.8.4-patch1, and netcdf-4.1.1-rc1 all in 64-bit mode (-m64 compiler flag) 
resulted in 18 of 55 tests failed with "make check" in libsrc4.  After applying 
your patch we reduced that to 2 of 55 tests failed:

  *** Testing file with just one very long dimension...Sorry! Unexpected 
result, tst_dims.c, line: 1010
  Sorry! Unexpected result, tst_dims.c, line: 1018
  2 failures
  *** Testing reference file with just one very long dimension...Sorry! 
Unexpected result, tst_dims.c, line: 1057
  1 failures
  3 errors detected! Sorry!
  FAIL: tst_dims

  *** Testing interoperability between big vs. little endian platforms.
  *** testing with file with lots of atts...ok.
  FAIL: tst_interops4

So we still have work to do, but it will have to wait until Ed gets back next 
week. Thanks again for your patch!

--Russ 

> Cheers,
> Mathis
> 
> --
> Mathis Rosenhauer
> German Climate Computing Center
> 
> 
> --- ../netcdf-4.1.1-rc1_orig/libsrc4/nc4file.c        2010-02-04 
> 18:17:38.000000000 +0100
> +++ libsrc4/nc4file.c 2010-03-03 13:38:49.000000000 +0100
> @@ -539,7 +539,11 @@
> else
> {
> start_of_len = dimscale_name_att + strlen(DIM_WITHOUT_VARIABLE);
> +#if (SIZEOF_SIZE_T < 8)
> sscanf(start_of_len, "%d", (int *)&grp->dim->len);
> +#else
> +            sscanf(start_of_len, "%ld", (size_t *)&grp->dim->len);
> +#endif
> }
> (*dim_without_var)++;
> }
> 
> 

Russ Rew                                         UCAR Unidata Program
address@hidden                      http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: HNO-635604
Department: Support netCDF
Priority: Normal
Status: Closed