Nah, it's failing for me too.  Looks like changing from %d to %u altered one
of the scanf behaviors.  Nope - it's a GCC optimization bug...

$ gcc sscanftest.c -o sscanftest
$ ./sscanftest
'       2.2'    is n2 m2 y0 l0 x0 prerc0 f=2    ->  202000000 expected
202000000
'      2.2c'    is n2 m2 y0 l3 x0 prerc0 f=3    ->  202000300 expected
202000300
'    2.2c.1'    is n2 m2 y0 l3 x1 prerc0 f=4    ->  202000301 expected
202000301

$ gcc -O2 sscanftest.c -o sscanftest
$ ./sscanftest
'       2.2'    is n2 m2 y0 l0 x0 prerc0 f=2    ->  202000000 expected
202000000
'      2.2c'    is n0 m2 y0 l3 x0 prerc0 f=3    ->    2000300 expected
202000300
'    2.2c.1'    is n0 m2 y0 l3 x1 prerc0 f=4    ->    2000301 expected
202000301

on this mini test program:

#define cNV2N(a, b) printf("-> %10u expected %10u\n",
convertNtopVersionToNumber(a), b)

unsigned int convertNtopVersionToNumber(char *versionString) {
  /* This one is purely an arbitrary conversion.
   *
   * But it knows about the version # schemes we've used in the past
   *  e.g. 2.2c, 2.2.50, 2.2.97, 3.0pre1, 3.0rc1 etc. so that the number
truly is relative
   * for numeric testing.
   *
   *  The goal is to get the following converted to ascending numeric order:
   *
   *   1.3 2.1 2.1.2 2.1.3 2.1.50 2.1.90 2.2 2.2a 2.2b 2.2c 2.2.50 2.2.97
3.0pre1 3.0rc1 3.0
   *
   * e.g.:
   *
   *   1.3     103000000
   *   2.1     201000000
   *   2.1.1   201000001
   *   2.1.2   201000002
   *   2.1.3   201000003
   *   2.1.50  201050000
   *   2.1.90  201090000
   *   2.2     202000000
   *   2.2a    202000100
   *   2.2b    202000200
   *   2.2c    202000300
   *   2.2.50  202050000
   *   2.2.90  202090000
   *   3.0pre1 299998001
   *   3.0rc1  299999001
   *   3.0rc2  299999002
   *   3.0     300000000
   *
   * n.m   -> nmm000000
   * n.m.x -> nmmyyy0xx  (if x>=50 yyy=x else xx=x)
   * n.ml  -> nmm000l00 (where a=1, b=2, etc.)
   */
  unsigned int f, n=0, m=0, x=0, y=0, c=0, prerc=0;
  unsigned char l=0;

  if (versionString == 0) {
    return 999999999;
  }

  printf("'%10s'", versionString);

  f = sscanf(versionString, "%u.%upre%u", &n, &m, &x);
  if(f>=3) {
    prerc=2;
  } else {
    f = sscanf(versionString, "%u.%urc%u", &n, &m, &x);
    if(f>=3) {
      prerc=1;
    } else {
      f = sscanf(versionString, "%u.%u%[a-z].%u", &n, &m, &l, &x);
      if(f>=3) {
        if(l>0)
          l = tolower(l) - 'a' + 1;
      } else {
        l = 0;
        f = sscanf(versionString, "%u.%u.%u", &n, &m, &x);
        if (f<=0) {
          return 999999999;
        }
      }
    }
  }
  if (x>=50) {
    y=x;
    x=0;
  }
  printf("\tis n%u m%u y%u l%u x%u prerc%u f=%u\t", n, m, y, l, x, prerc,
f);
  return n*100000000 + m*1000000 + y*1000 + l*100 + x - 1000*prerc;
}

int main(int argc, char *argv[]) {
    cNV2N("2.2",    202000000);
    cNV2N("2.2c",   202000300);
    cNV2N("2.2c.1", 202000301);
}


I'll have to develop a workaround and report the GCC bug.

-----Burton

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Ted
> Kaczmarek
> Sent: Wednesday, January 07, 2004 3:05 PM
> To: [EMAIL PROTECTED]
> Subject: [Ntop] **WARNING** CHKVER: Please report to ntop mailing list,
> codes
>
>
> Cvs checkout from 1:00pm EST US,1/7/04.
> redhat 9
> codes (202000000,2000300,2000300,202098000,202098000)
>
> Any other info you want?
>
>
> [EMAIL PROTECTED] root]# ntop -u ntop -w 3330 -i none
> 07/Jan/2004 16:01:32  ntop v.2.2.98 MT (SSL)
> 07/Jan/2004 16:01:32  Configured on Jan  7 2004 15:04:13, built on Jan
> 7 2004 15:55:24.
> 07/Jan/2004 16:01:32  Copyright 1998-2004 by Luca Deri <[EMAIL PROTECTED]>
> 07/Jan/2004 16:01:32  Get the freshest ntop from http://www.ntop.org/
> 07/Jan/2004 16:01:32  Initializing ntop
> 07/Jan/2004 16:01:32  Creating dummy interface, 'none'
> 07/Jan/2004 16:01:32  -i none, so initialized only a dummy device
> 07/Jan/2004 16:01:32  Checking none for additional devices
> 07/Jan/2004 16:01:32  Resetting traffic statistics for device none
> 07/Jan/2004 16:01:32  Initializing gdbm databases
> 07/Jan/2004 16:01:32  Now running as requested user 'ntop' (100:102)
> 07/Jan/2004 16:01:32  VENDOR: Loading MAC address table.
> 07/Jan/2004 16:01:32  VENDOR: Checking './specialMAC.txt.gz'
> 07/Jan/2004 16:01:32  VENDOR: Checking
> '/usr/local/etc/ntop/specialMAC.txt.gz'
> 07/Jan/2004 16:01:32  VENDOR: File
> '/usr/local/etc/ntop/specialMAC.txt.gz' does not need to be reloaded
> 07/Jan/2004 16:01:32  VENDOR: Checking './oui.txt.gz'
> 07/Jan/2004 16:01:32  VENDOR: Checking '/usr/local/etc/ntop/oui.txt.gz'
> 07/Jan/2004 16:01:32  VENDOR: File '/usr/local/etc/ntop/oui.txt.gz' does
> not need to be reloaded
> 07/Jan/2004 16:01:32  Reading AS info...
> 07/Jan/2004 16:01:33  Read 111435 ASs [Used 3779 KB of memory]
> 07/Jan/2004 16:01:33  I18N: This instance of ntop does not support
> multiple languages
> 07/Jan/2004 16:01:33  IP2CC: Looking for IP address <-> Country code
> mapping file
> 07/Jan/2004 16:01:33  IP2CC: reading file
> '/usr/local/etc/ntop/p2c.opt.table.gz'
> 07/Jan/2004 16:01:34  IP2CC: 49056 records read
> 07/Jan/2004 16:01:34  Initializing external applications
> 07/Jan/2004 16:01:34  Initializing semaphores, mutexes and threads
> 07/Jan/2004 16:01:34  NOTE: atfork() handler registered for mutexes, rc
> 0
> 07/Jan/2004 16:01:34  THREADMGMT: Packet processor thread running...
> 07/Jan/2004 16:01:34  THREADMGMT: Started thread (1104190256) for
> network packet analyser
> 07/Jan/2004 16:01:34  THREADMGMT: Idle host scan thread running...
> 07/Jan/2004 16:01:34  THREADMGMT: Started thread (1116957488) for idle
> hosts detection
> 07/Jan/2004 16:01:34  THREADMGMT: Address resolution thread running...
> 07/Jan/2004 16:01:34  THREADMGMT: Started thread (1125350192) for DNS
> address resolution
> 07/Jan/2004 16:01:34  Calling plugin start functions (if any)
> 07/Jan/2004 16:01:34  Sniffying...
> 07/Jan/2004 16:01:34  INIT: Created pid file
> (/usr/local/var/ntop/ntop.pid)
> 07/Jan/2004 16:01:34  CHKVER:
> **********************PRIVACY**NOTICE**********************
> 07/Jan/2004 16:01:34  CHKVER: * ntop instances may record individually
> identifiable     *
> 07/Jan/2004 16:01:34  CHKVER: * information on a remote system as part
> of the version   *
> 07/Jan/2004 16:01:34  CHKVER: *
> check.                                                  *
> 07/Jan/2004 16:01:34  CHKVER:
> *                                                         *
> 07/Jan/2004 16:01:34  CHKVER: * You may request - via the
> --skip-version-check option   *
> 07/Jan/2004 16:01:34  CHKVER: * that this check be skipped and that no
> individually     *
> 07/Jan/2004 16:01:34  CHKVER: * identifiable information be
> recorded.                   *
> 07/Jan/2004 16:01:34  CHKVER:
> *                                                         *
> 07/Jan/2004 16:01:34  CHKVER: * In general, we ask you to permit this
> check because it  *
> 07/Jan/2004 16:01:34  CHKVER: * benefits both the users and developers
> of ntop.         *
> 07/Jan/2004 16:01:34  CHKVER:
> *                                                         *
> 07/Jan/2004 16:01:34  CHKVER: * Review the man ntop page for more
> information.          *
> 07/Jan/2004 16:01:34  CHKVER:
> *                                                         *
> 07/Jan/2004 16:01:34  CHKVER:
> **********************PRIVACY**NOTICE**********************
> 07/Jan/2004 16:01:34  CHKVER: Checking current ntop version at
> www.burtonstrauss.com/version.xml
> 07/Jan/2004 16:01:34  Listening on [none]
> 07/Jan/2004 16:01:34  Now running as requested user 'ntop' (100:102)
> 07/Jan/2004 16:01:34  Loading Plugins
> 07/Jan/2004 16:01:34  Searching for plugins in
> /usr/local/lib/ntop/plugins
> 07/Jan/2004 16:01:34  ICMP: Welcome to icmpWatchPlugin. (C) 1999 by Luca
> Deri
> 07/Jan/2004 16:01:34  LASTSEEN: Welcome to LastSeenWatchPlugin. (C) 1999
> by Andrea Marangoni
> 07/Jan/2004 16:01:34  NETFLOW: Welcome to NetFlow.(C) 2002-04 by Luca
> Deri
> 07/Jan/2004 16:01:34  NFS: Welcome to nfsWatchPlugin. (C) 1999 by Luca
> Deri
> 07/Jan/2004 16:01:34  PDA: Welcome to PDAPlugin. (C) 2001-2002 by L.Deri
> and W.Brock
> 07/Jan/2004 16:01:34  SFLOW: Welcome to sFlowPlugin. (C) 2002-04 by Luca
> Deri
> 07/Jan/2004 16:01:34  RRD: Welcome to rrdPlugin. (C) 2002-04 by Luca
> Deri.
> 07/Jan/2004 16:01:34  Calling plugin start functions (if any)
> 07/Jan/2004 16:01:34  RRD: Welcome to the RRD plugin
> 07/Jan/2004 16:01:34  RRD: Mask for new directories is 0700
> 07/Jan/2004 16:01:34  RRD: Mask for new files is 0066
> 07/Jan/2004 16:01:34  THREADMGMT: rrd thread (1142135600) started
> 07/Jan/2004 16:01:34  RRD: Started thread (1142135600) for data
> collection.
> 07/Jan/2004 16:01:34  SFLOW: Collector listening on port 6343
> 07/Jan/2004 16:01:34  Creating dummy interface, 'sFlow-device'
> 07/Jan/2004 16:01:34  THREADMGMT: sFlow thread (1150528304) started...
> 07/Jan/2004 16:01:34  SFLOW: Welcome to sFlow: listening on UDP port
> 6343
> 07/Jan/2004 16:01:34  SSL is present but https is disabled: use -W
> <https port> for enabling it
> 07/Jan/2004 16:01:34  Note: Reporting device initally set to 1
> [sFlow-device]
> 07/Jan/2004 16:01:34  WEB: Initializing web server
> 07/Jan/2004 16:01:34  WEB: Initializing tcp/ip socket connections for
> web server
> 07/Jan/2004 16:01:34  FILEDESCRIPTORBUG: Work-around activated
> 07/Jan/2004 16:01:34  **WARNING** CHKVER: version file INVALID -
> ignoring version check
> 07/Jan/2004 16:01:38  **WARNING** CHKVER: Please report to ntop mailing
> list, codes (202000000,2000300,2000300,202098000,202098000)
> 07/Jan/2004 16:01:38  Initialized socket, port 3330, address (any)
> 07/Jan/2004 16:01:38  WEB: Waiting for HTTP connections on port 3330
> 07/Jan/2004 16:01:38  WEB: Starting web server
> 07/Jan/2004 16:01:38  THREADMGMT: web connections thread (7390)
> started...
> 07/Jan/2004 16:01:38  Note: SIGPIPE handler set (ignore)
> 07/Jan/2004 16:01:38  THREADMGMT: Started thread (1158921008) for web
> server
>
>
> Ted
> _______________________________________________
> Ntop mailing list
> [EMAIL PROTECTED]
> http://listgateway.unipi.it/mailman/listinfo/ntop
>

_______________________________________________
Ntop mailing list
[EMAIL PROTECTED]
http://listgateway.unipi.it/mailman/listinfo/ntop

Reply via email to