Subject: bin/32847: altqstat -c logic error
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: None <jdwhite@jdwhite.org>
List: netbsd-bugs
Date: 02/15/2006 22:00:00
>Number:         32847
>Category:       bin
>Synopsis:       The altqstat '-c' flag does not funciton properly.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Feb 15 22:00:00 +0000 2006
>Originator:     Jason White
>Release:        NetBSD 3.0
>Organization:
Jason White <jdwhite@jdwhite.org>       Jabber: jdwhite(jabber.org)
http://www.jdwhite.org/~jdwhite                 jason.d.white(gmail.com)
PGP KeyID: 0x5290E477/A8A2 3FDB AB33 98EB ED74  EDAA F538 9A30 5290 E477
>Environment:
System: NetBSD bender.jdwhite.org 3.0 NetBSD 3.0 (BENDER) #0: Thu Feb 2 17:13:01 CST 2006 jdwhite@smeghead:/usr/obj/i386/BENDER i386
Architecture: i386
Machine: i386
>Description:
'altqstat -c <count>' is supposed to "[exit] after displaying <count> times."
If <count> is greater than one, then there is a pause (default 5 seconds) 
between status displays.  What seems to be happening is:
    1) the pause happens before the status is displayed
    2) the count check happens after the pause, but before the status
       is displayed, resulting in no status displays if a count of one is 
       specified and unnecesary pre/post-status display delays if count is 
       greater than one.

>How-To-Repeat:
Example:

    # altqstat -c 1
    altqstat: cbq on interface XXXX
    <5 second pause>
    #

No status output and a 5 second pause before exiting.
Now we try with '-c 2': 

    # altqstat -c 2
    altqstat: cbq on interface XXXX
    <5 second pause>
    Root Class for Interface XXXX: root
    [...status display removed...]
    <5 second pause>
    #

This time we get a 5 second pause before and after the status display before 
exiting.

>Fix: