complogs

  • Downloaded a Perl compatible Diff module from Perl Diff and adapted it for use with complogs
  • Created complogs to compare two log files and print out their differences in terms of warnings

complogs

I have developed a script to compare two logfile and print out the differences in terms of warnings. First of all this script leans on a prior script, check, (which should be in /int/bin and /int/bin should be in your path. BTW: That's where complogs is also).

Secondly it attempts to be semi intelligent WRT comparing warnings. In order to do this I had downloaded a Perl Diff module and adapted it for use with complogs. Normally one would install a Perl module into the system library. But I cannot tell where complog will be run Side note: At a previous company we compiled a version of Perl and placed it on a network accessible area like /int. We also altered it to look at a network path for Perl modules. This meant that one need only install a new Perl module once in the network area and the networked Perl would automatically see it. Lacking that I've installed this Diff.pm into /int/lib.

This Diff.pm module allows me to diff two arrays and provide a function for determining equality. Thus I have the following function:

    sub hash {
      # Return the line possibly removing any line number. For example, a
      # line such as the following:
      #
      # syscall_switch.c:14: warning: initialization from incompatible pointer type
      #
      # has a line number (14) in it. A subsequent compile of
      # syscall_switch.c may generate the same warning but the line number
      # may change (e.g. 16). It's the same warning so we will remove the
      # string ":\d*:" from the output. This is a bit kludgy.
      my $line = shift;

      return $line =~ s/(\w*\.[ch]):\d*:( warning:)/$1$2/;
    } # hash

This helps cut down on warnings that have only changed line numbers.

I've tested this with a few install.log's that I've found. For example:

    saturn:complogs 20050718.install.log 20050722.install.log
    ----------------------------------------------------------------------
    Warnings removed:
    ----------------------------------------------------------------------
    1439    bsp_pcibus.c:783: warning: unused variable `bus'
    1440    bsp_pcibus.c:784: warning: unused variable `dev'
    1441    bsp_pcibus.c:785: warning: unused variable `func'
    1442    bsp_pcibus.c:150: warning: 'pci_bridge_init' defined but not used
    1443    bsp_reboot.c:168: warning: implicit declaration of function `hw_local_reset'
    1444    bsp_reboot.c:171: warning: implicit declaration of function `stopcpu'
    ----------------------------------------------------------------------
    TOTAL:  6
    ----------------------------------------------------------------------
    Warnings added:
    ----------------------------------------------------------------------
    1881    /usr/los178/3.0.0/ppc_dev/sys/include/kernel/kernel.h:94:1: warning: this is the location of the previous definition
    3378    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3379    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3380    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3381    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3382    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3383    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3384    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3385    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3386    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3387    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3388    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3389    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3390    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3391    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3392    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3393    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3394    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3395    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3396    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3397    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3398    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3399    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3400    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3401    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3403    regex.h:39:1: warning: "RE_DUP_MAX" redefined
    3404    /usr/los178/3.0.0/ppc_dev/usr/include/limits.h:162:1: warning: this is the location of the previous definition
    3412    regex.c:4825: warning: passing arg 2 of `bcmp_translate' discards qualifiers from pointer target type
    3415    ../tar-1.11.2/getdate.y:807: warning: static declaration of 'getdate_yylex' follows non-static declaration
    3416    bison.simple:332: warning: previous implicit declaration of 'getdate_yylex' was here
    3419    /usr/los178/3.0.0/ppc_dev/usr/include/wait.h:58:2: warning: #warning Using  instead of 
    3421    pipesize.h:8:1: warning: "PIPESIZE" redefined
    3422    /usr/los178/3.0.0/ppc_dev/usr/include/conf.h:76:1: warning: this is the location of the previous definition
    3424    display.c:1155: warning: comparison is always true due to limited range of data type
    3425    malloc.c:521: warning: conflicting types for built-in function 'malloc'
    3426    malloc.c:798: warning: conflicting types for built-in function 'calloc'
    3427    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3428    ../ex/ex_cd.c:75: warning: assignment from incompatible pointer type
    3429    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3430    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3431    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3432    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3433    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3434    ../vi/getc.c:63: warning: passing arg 3 of `db_eget' from incompatible pointer type
    3435    ../vi/getc.c:193: warning: passing arg 4 of `db_get' from incompatible pointer type
    3436    ../common/key.c:159: warning: comparison is always true due to limited range of data type
    3437    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3438    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3439    ../common/recover.c:368: warning: assignment from incompatible pointer type
    3440    ../vi/v_txt.c:2184: warning: comparison of distinct pointer types lacks a cast
    3441    ../vi/v_txt.c:2202: warning: comparison of distinct pointer types lacks a cast
    3442    ../vi/v_ulcase.c:130: warning: passing arg 4 of `db_get' from incompatible pointer type
    3443    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3444    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3445    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3446    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3447    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3448    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3449    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3450    /usr/los178/3.0.0/ppc_dev/usr/include/sys/uio.h:21:2: warning: #warning Using  instead of 
    3451    /usr/los178/3.0.0/ppc_dev/usr/include/sys/param.h:21:2: warning: #warning Using  instead of 
    3452    /usr/los178/3.0.0/ppc_dev/usr/include/cdefs.h:21:2: warning: #warning Using  instead of 
    3453    /usr/los178/3.0.0/ppc_dev/usr/include/cdefs.h:21:2: warning: #warning Using  instead of 
    ----------------------------------------------------------------------
    TOTAL:  63