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

20000720: LDM-McIDAS pnga2area minor fix



>From: Alan Feltz <address@hidden>
>Organization: University of Kansas
>Keywords: 200007201839.e6KIdkT09835 ldm-mcidas pnga2area udebug

Alan,

>I have found a very minor non-critical coding problem in the
>LDM-McIdas 7.6.3  pnga2area.c  source code.  If you are aware of
>this already or this is not the correct place to send this, please
>disregard.

I am always happy to get bug reports for ldm-mcidas!

>Otherwise, here goes:
>
>The nature of the problem is that when specifying  the  -l <logfile>
>option to  pnga2area , pnga2area  still writes out a single debugging
>line to  syslog  each time  pnga2area  is run.  As I said, this is minor,
>but it fills up the syslogs with unnecessary information.

Oops.  I see it now.  The udebug line appears before the setup of syslog.
The log message will, therefore, go to the system logs and not the
log file specified with the '-l' flag.  Thanks for informing me of this.

>I have determined that the problem occurs because there is a  udebug(...)
>call before the system logging files are initialized.

Right.  There should be no logging, however, if '-x' (debug logging)
is not specified.

>The  udebug( "MCPATH: %s", mcpathdir );  line (marked with *----> below)
>occurs in the  ** Sanity checks  section of code which occurs before the
>openulog(...)  function call in the  ** Setup syslog logging.  section of
>code.  See below.
>
>
>In  ldm-mcidas-7.6.3/src/decode/pnga2area.c  within  main() :
>
>    /*
>    ** Sanity checks
>    */
>
>    if ( argc - optind < 0 ) {
>      usage( argv[0] );
>      exit( 0 );
>    }
>
>    if ( argc != (optind + 1) ) {          /* output file name not specified *
> /
>     if ( pcode != (char *) NULL ) {                 /* '-r' flag specified */
>        if ( datadir == (char *) NULL ) {         /* '-d' flag not specified *
> /
>         (void) strcpy( mcpathdir, "./" );
>        } else {
>          (void) strcpy( mcpathdir, datadir );
>        }
>*---->  udebug( "MCPATH: %s", mcpathdir );
>      } else {
>        printf( "No output file name specified, exiting\n" );
>        exit( 1 );
>      }
>    }
>      .
>      .
>      .
>
>    /*
>    ** Setup syslog logging.
>    */
>
>    (void) setulogmask( logmask );
>
>    if ( logfname == NULL || !(*logfname == '-' && logfname[1] == 0) )
>      (void) fclose( stderr );
>
>    logfd = openulog( ubasename(argv[0]), (LOG_CONS|LOG_PID), LOG_LDM,
>                      logfname );
>
>    if ( logfname == NULL || !(*logfname == '-' && logfname[1] == 0) ) {
>      setbuf( fdopen(logfd, "a" ), NULL);
>    }
>
>To fix this problem, I placed the  ** Setup syslog logging.  section of
>code before the  ** Sanity checks  section of code and it appears to have
>solved the problem.

In the next release of ldm-mcidas, I will simply remove this debug
statement.  I don't think that it is really needed.

>I hope this was useful and not too confusing.

Yes!  Thanks for reporting the bug!

>Alan Feltz
>Unix Sys Admin
>Dept of Physics and Astronomy
>University of Kansas
>Lawrence, KS  66045
>address@hidden
>(785) 864-5164

Tom Yoksas