From nobody@FreeBSD.ORG  Mon Jul 10 00:18:33 2000
Return-Path: <nobody@FreeBSD.ORG>
Received: by hub.freebsd.org (Postfix, from userid 32767)
	id 43E2537B669; Mon, 10 Jul 2000 00:18:33 -0700 (PDT)
Message-Id: <20000710071833.43E2537B669@hub.freebsd.org>
Date: Mon, 10 Jul 2000 00:18:33 -0700 (PDT)
From: scott_long@btc.adaptec.com
Sender: nobody@FreeBSD.ORG
To: freebsd-gnats-submit@FreeBSD.org
Subject: usbd broken, does not parse usbd.conf
X-Send-Pr-Version: www-1.0

>Number:         19817
>Category:       misc
>Synopsis:       usbd broken, does not parse usbd.conf
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    n_hibma
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jul 10 00:20:01 PDT 2000
>Closed-Date:    Sun Aug 6 16:33:23 PDT 2000
>Last-Modified:  Sun Aug 06 16:34:16 PDT 2000
>Originator:     Scott Long
>Release:        5.0-CURRENT
>Organization:
>Environment:
FreeBSD mitchman.co 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Sun Jul  9 22:33:53 MDT 2000     scottl@mitchman.co:/usr/obj/usr/src/sys/MITCHMAN  i386

>Description:
usbd fails to parse it's config file, usbd.conf.  Even though the conf
file is correct in all respects, attempting to start usbd yields 
"etc/usbd.conf:10: Syntax error in 'device'".  Looking at the source
of usbd shows a for loop that reads each line of the conf file and
parses it.  The problem arises in that when the 'device' line is parsed,
the same line is then parsed for the next keyword.  COrrect behaviour 
is for the for loop to break and allow the next conf file line to be
read in.  Attahched patch does this. 
>How-To-Repeat:
Problem will be apparent when usbd is run
>Fix:
*** usbd.c.old  Mon Jul 10 00:48:05 2000
--- usbd.c      Mon Jul 10 00:46:46 2000
***************
*** 516,528 ****
  
                        /* Add it to the end of the list to preserve order */
                        STAILQ_INSERT_TAIL(&actions, action, next);
-               }
  
!               if (action == NULL) {
!                       line[len] = '\0';       /* XXX zero terminate */
!                       fprintf(stderr, "%s:%d: Doesn't start with 'device' "
!                               "but '%s'\n", configfile, lineno, field);
!                       exit(2);
                }
                
                for (i = 0; config_fields[i].name  ; i++) {
--- 516,531 ----
  
                        /* Add it to the end of the list to preserve order */
                        STAILQ_INSERT_TAIL(&actions, action, next);
  
!                       if (action == NULL) {
!                               line[len] = '\0';       /* XXX zero terminate */!                               fprintf(stderr, "%s:%d: Doesn't start with "
!                                       "'device' but '%s'\n", configfile, 
!                                       lineno, field);
!                               exit(2);
!                       }
!               /* Break here so that the next line can be parsed */
!               break;
                }
                
                for (i = 0; config_fields[i].name  ; i++) {


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->n_hibma 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Mon Jul 10 04:49:26 PDT 2000 
Responsible-Changed-Why:  
Nick, this one has a patch on it. :-) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19817 

From: Nick Hibma <n_hibma@calcaphon.com>
To: freebsd-gnats-submit@FreeBSD.org, scott_long@btc.adaptec.com
Cc:  
Subject: Re: misc/19817: usbd broken, does not parse usbd.conf
Date: Mon, 10 Jul 2000 15:34:48 +0100

 Scott,
 
 could you send me the offending usbd file?
 
 The code as it is is correct. The device line is used twice, first for
 the allocation of a fresh action and then for filling in the appropriate
 information.
 
 But I'd like to have a look at your usbd.conf file to make sure that
 there is not another problem hiding somewhere.
 
 Nick
 --
 Work: n_hibma@calcaphon.com             Personal: n_hibma@webweaving.org
 
 
 
 
State-Changed-From-To: open->feedback 
State-Changed-By: n_hibma 
State-Changed-When: Fri Jul 14 15:49:00 PDT 2000 
State-Changed-Why:  
Peter Wemm and green submitted a patch for this problem. Waiting 
for feedback from submitter whether this solves the problem for 
him. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19817 

From: "Long, Scott" <scott_long@btc.adaptec.com>
To: "'freebsd-gnats-submit@FreeBSD.org'" <freebsd-gnats-submit@freebsd.org>,
	"Long, Scott" <scott_long@btc.adaptec.com>
Cc:  
Subject: Re: misc/19817: usbd broken, does not parse usbd.conf
Date: Fri, 14 Jul 2000 17:25:15 -0600

 The submitted fix resolves the problem for me.  Thanks
 
State-Changed-From-To: feedback->closed 
State-Changed-By: n_hibma 
State-Changed-When: Sun Aug 6 16:33:23 PDT 2000 
State-Changed-Why:  
The problem was solved by Peter Wemm. The problem was changed 
malloc flags that tripped a bugh in the code. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19817 
>Unformatted:
