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

Re: Installation Problems



Hi Glen,

You were wondering if the version of netCDF 2.4.2 you installed was
correct, because you got a segmentation violation when trying to invoke

   ncdump 961361500q.cdf

on a netCDF file you had gotten from somewhere else.

It looks like your version of ncdump is fine, but the file has been
corrupted by the deletion of at least one byte (the 53rd or 54th) in the
original file.  This missing byte resulted in the netCDF library reading an
absurdly large value for the size of the "rptStationLen" dimension name,
which caused an error path to be taken that had never been tested and
resulted in a segmentation violation in trying to print out an error
message about the length of the name exceeding the limit.

When I inserted a zero byte in the file at the 53rd byte position, invoking

   ncdump -h 961361500q.cdf

to print out just the header information worked fine, but trying 

   ncdump 961361500q.cdf

still got an error later on, which I suspect may be related to a later
corruption of the file, but I'm still looking into that.

In any case, this has revealed a bug we had not previously encountered in
trying to read a corrupted data file.  The patch for that problem is a fix
to the file libsrc/string.c, which I have appended to this message.

Since netCDF files are binary files, you may want to look at the process by
which you got the file.  Evidently something prevented the reliable
transport of the file.  One way to check this sort of thing would be to
look at the number of bytes in the original and the copy, or to run a
checksum on both, using the Unix "sum" program, for example.

______________________________________________________________________________

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



diff -c -r1.29 string.c
*** 1.29        1995/07/28 16:27:24
--- string.c    1996/06/06 19:55:47
***************
*** 19,28 ****
  
        if(count > MAX_NC_NAME)
        {
!               NCadvise(NC_EMAXNAME,
                        "string \"%c%c%c%c%c%c ...\"  length %d exceeds %d",
                        str[0], str[1], str[2], str[3], str[4], str[5],
                        count,  MAX_NC_NAME ) ;
                return NULL ;
        }
                
--- 19,33 ----
  
        if(count > MAX_NC_NAME)
        {
!               if (str != NULL) {
!                   NCadvise(NC_EMAXNAME,
                        "string \"%c%c%c%c%c%c ...\"  length %d exceeds %d",
                        str[0], str[1], str[2], str[3], str[4], str[5],
                        count,  MAX_NC_NAME ) ;
+               } else {
+                   NCadvise(NC_EMAXNAME,
+                       "string length %d exceeds %d", count,  MAX_NC_NAME ) ;
+               }
                return NULL ;
        }