From nobody@FreeBSD.org  Sat May  6 10:07:38 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 9F15716A415
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  6 May 2006 10:07:38 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 2570F43D6A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  6 May 2006 10:07:35 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k46A7Y0x074624
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 6 May 2006 10:07:34 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k46A7YSV074623;
	Sat, 6 May 2006 10:07:34 GMT
	(envelope-from nobody)
Message-Id: <200605061007.k46A7YSV074623@www.freebsd.org>
Date: Sat, 6 May 2006 10:07:34 GMT
From: "Shin'ya Kumabuchi" <kumabu@t3.rim.or.jp>
To: freebsd-gnats-submit@FreeBSD.org
Subject: devd(8) parses events incorrectly in some cases
X-Send-Pr-Version: www-2.3

>Number:         96854
>Category:       bin
>Synopsis:       [patch] devd(8) parses events incorrectly in some cases
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    imp
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 06 10:10:26 GMT 2006
>Closed-Date:    Fri May 13 14:50:28 MDT 2011
>Last-Modified:  Fri May 13 14:50:28 MDT 2011
>Originator:     Shin'ya Kumabuchi
>Release:        6-stable
>Organization:
>Environment:
FreeBSD hoge 6.0-STABLE FreeBSD 6.0-STABLE #1: Mon Jan 23 05:39:57 JST 2006     root@hoge:/usr/local/obj/usr/src/sys/KUMA  i386
>Description:
devd should care about multiple white spaces in event message.
For example my usb speaker produces following event.
(with running devd -Dd)

Processing event '+pcm1  at   on uaudio0'
(Processing event '+pcm1&#x20;&#x20;at&#x20;&#x20;&#x20;on uaudio0')

But devd is expecting that words are delimited by single space,
so particular event isn't fully parsed by devd.

# In above case, `bus=uaudio0' should be set.
>How-To-Repeat:

>Fix:
--- /usr/src/sbin/devd/devd.cc.org      Mon Dec 19 12:33:05 2005
+++ /usr/src/sbin/devd/devd.cc  Sat May  6 18:58:34 2006
@@ -644,9 +644,11 @@
                if (sp == NULL)
                        return; /* Can't happen? */
                *sp++ = '\0';
+               while (isspace(*sp)) sp++;
                if (strncmp(sp, "at ", 3) == 0)
                        sp += 3;
                sp = cfg.set_vars(sp);
+               while (isspace(*sp)) sp++;
                if (strncmp(sp, "on ", 3) == 0)
                        cfg.set_variable("bus", sp + 3);
                break;
@@ -657,9 +659,11 @@
                        return; /* Can't happen? */
                *sp++ = '\0';
                cfg.set_variable("device-name", buffer);
+               while (isspace(*sp)) sp++;
                if (strncmp(sp, "at ", 3) == 0)
                        sp += 3;
                sp = cfg.set_vars(sp);
+               while (isspace(*sp)) sp++;
                if (strncmp(sp, "on ", 3) == 0)
                        cfg.set_variable("bus", sp + 3);
                break;

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->imp 
Responsible-Changed-By: glebius 
Responsible-Changed-When: Wed May 24 11:59:10 UTC 2006 
Responsible-Changed-Why:  
Assign to author of devd. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=96854 
State-Changed-From-To: open->patched 
State-Changed-By: imp 
State-Changed-When: Sat Oct 9 01:29:36 MDT 2010 
State-Changed-Why:  
Patch committed. 

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

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/96854: commit references a PR
Date: Sat,  9 Oct 2010 07:29:21 +0000 (UTC)

 Author: imp
 Date: Sat Oct  9 07:29:13 2010
 New Revision: 213646
 URL: http://svn.freebsd.org/changeset/base/213646
 
 Log:
   Allow the kernel to generate more spacy things and still have devd
   cope.  Skip multiple spaces in a few contexts.
   
   PR:		96854
   Submitted by:	Shin'ya Kumabuchi
   MFC after:	1 week
 
 Modified:
   head/sbin/devd/devd.cc
 
 Modified: head/sbin/devd/devd.cc
 ==============================================================================
 --- head/sbin/devd/devd.cc	Sat Oct  9 05:57:23 2010	(r213645)
 +++ head/sbin/devd/devd.cc	Sat Oct  9 07:29:13 2010	(r213646)
 @@ -749,9 +749,13 @@ process_event(char *buffer)
  		if (sp == NULL)
  			return;	/* Can't happen? */
  		*sp++ = '\0';
 +		while (isspace(*sp))
 +			sp++;
  		if (strncmp(sp, "at ", 3) == 0)
  			sp += 3;
  		sp = cfg.set_vars(sp);
 +		while (isspace(*sp))
 +			sp++;
  		if (strncmp(sp, "on ", 3) == 0)
  			cfg.set_variable("bus", sp + 3);
  		break;
 @@ -762,9 +766,13 @@ process_event(char *buffer)
  			return;	/* Can't happen? */
  		*sp++ = '\0';
  		cfg.set_variable("device-name", buffer);
 +		while (isspace(*sp))
 +			sp++;
  		if (strncmp(sp, "at ", 3) == 0)
  			sp += 3;
  		sp = cfg.set_vars(sp);
 +		while (isspace(*sp))
 +			sp++;
  		if (strncmp(sp, "on ", 3) == 0)
  			cfg.set_variable("bus", sp + 3);
  		break;
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: imp 
State-Changed-When: Fri May 13 14:50:00 MDT 2011 
State-Changed-Why:  
done. 

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