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

Re: "fix" for NetCDF on HP/UX; also, new version of Ncview



> Organization: Climate Research Division / Scripps Institution of Oceanography
> Keywords: 199409131848.AA25958 HP/UX FILENAME_MAX

Hi Dave,

> I've been having problems using NetCDF under our HP/UX system (a 735/90)
> and finally traced it down.  The symptom was that repeatedly entering and
> exiting define mode for a file could generate spurious NetCDF files with
> truncated filenames, and the desired total NetCDF file was not created.
> For example, trying to work on 'lsgout.04025.00.nc' would create spurious
> files 'lsgout.04025.0' and 'lsgout.04025.0f'.  The problem stems from the
> fact that in <stdio.h> on the HP, FILENAME_MAX is defined to 14.  This is
> despite the fact that (as far as I can tell--and I use this feature
> heavily) actual filenames can be much longer.  No documentation that I
> could find instructs the user to limit filenames to 14 characters (but we
> don't have a full documentation set).  Anyway, if you simply comment out
> the part in local_nc.h which checks for FILENAME_MAX being set before
> setting it to 255--so that it is always set to 255--things seem to work as
> they should.  This isn't really a bug with NetCDF, but it certainly looks
> that way to a user, so I thought I'd mention it in case anyone asks you
> for help with this. 

Thanks for the information.  It turns out we had already encountered this
problem and put a reference to it in our on-line FAQ for netCDF, at 

    http://www.unidata.ucar.edu/packages/netcdf/faq.html

Here's the answer we provide; please let me know if anything in this is wrong:

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

> Also, I have a new version of Ncview.  It includes bug fixes and better 
> out-of-the-box support for different platforms, and a couple new 
> features.  Let me know if you have a place I can upload it to.

Yes, that would be great.  I'm pretty sure you can upload into the directory
I set up for you last time, in incoming/pierce/ on ftp.unidata.ucar.edu.
Please let me know if you have problems uploading there.  Thanks.

--
Russ Rew                                                UCAR Unidata Program
address@hidden                                          P.O. Box 3000
http://www.unidata.ucar.edu/                          Boulder, CO 80307-3000