bin/96854: devd(8) parses events incorrectly in some cases

Shin'ya Kumabuchi kumabu at t3.rim.or.jp
Sat May 6 10:10:41 UTC 2006


>Number:         96854
>Category:       bin
>Synopsis:       devd(8) parses events incorrectly in some cases
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat May 06 10:10:26 GMT 2006
>Closed-Date:
>Last-Modified:
>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 at 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  at   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:
>Unformatted:


More information about the freebsd-bugs mailing list