NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


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

Re: Problem with NcFile::add_var



> Organization: NOAA/FSL
> Keywords: 199404221711.AA16892

Hi Tom,

> We recently ported our application to a Hewlett Packard system and I've
> bumped into a new problem.
> 
> When I call NcFile::add_var I get different behavior depending on the
> path passed to the NcOldFile constructor.  If the path contains no
> directories, (the .cdf file is in the local directory) everything works
> fine.  But if the path includes some directory I get a NULL pointer
> back from add_var.
> 
> For example,
> 
> If the path is defined as "myDatabase.cdf",  no problem.
> 
> If the path is defined as "/home/whatever/myDatabase.cdf",  add_var
> returns a NULL.
> 
> It doesn't matter if the file is in the current directory or not.  If
> there is a directory in the path add_var won't work.  I should mention
> that the database opens just fine in either case.

This is just a guess, but I'll bet the problem is in the netCDF C library on
HP and would be fixed by rebuilding it with the patch described in the
following small answer to a netCDF FAQ:

13. Is there a known bug with netCDF under HPUX? 

   The current version of the HPUX operating system provides an incorrect
   definition of the FILENAME_MAX macro. This results in the symptom that
   the ncredef() function does not work properly when invoked from a
   directory other than the one the open netCDF file is in. A workaround is
   to apply the following patch to the file netcdf/libsrc/local_nc.h before
   building the library:

       
diff -c -r1.39 local_nc.h
*** /tmp/T0a004uN       Tue Mar  8 11:14:12 1994
--- local_nc.h  Wed Feb  9 15:56:36 1994
***************
*** 12,17 ****
--- 12,21 ----
  
  #include      <stddef.h> /* size_t */
  #include      <stdio.h> /* FILENAME_MAX */
+ #if defined(_HPUX_SOURCE) && FILENAME_MAX < 255
+ /* Arrgh. HP thinks FILENAME_MAX is _POSIX_NAME_MAX */
+ #undef FILENAME_MAX
+ #endif
  #ifndef FILENAME_MAX
  #define FILENAME_MAX  255
  #endif

Let me know if this doesn't fix the problem.

--Russ