Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2002 07:21:55 -0700 (PDT)
From:      Tom Limoncelli <tal@lumeta.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   i386/37379: /dev/MAKEDEV entry for RocketPort is broken
Message-ID:  <200204231421.g3NELtI81692@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         37379
>Category:       i386
>Synopsis:       /dev/MAKEDEV entry for RocketPort is broken
>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:   Tue Apr 23 07:30:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Tom Limoncelli
>Release:        4.5-RELEASE
>Organization:
Lumeta Corp
>Environment:
FreeBSD scan2.prod.lumeta.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Feb 25 14:05:51 EST 2002     anon@devscan2:/usr/src/sys/compile/INT  i386
>Description:
The code in /dev/MAKEDEV to create the cuaR* and ttyR* devices is 
broken.

There are 2 bugs:

1) MAKEDEV assumes that only one "RocketPort = 32" will appear in the output of dmesg.  Not true if you have multiple cards or have rebooted many times.
As a result, $ndevices="32\n32\n32\n32\n" instead of "32", similar problem with $controllers.  The output looks like:

Creating 32
32
32
32
32 devices for RocketPort0: [: 32: unexpected operator

2)  The code relies on "dmesg" to find out what controllers exist.  I consider this to be a problem, albiet minor.  If the machine hasn't been rebooted in long enough that dmesg no longer mentions "RocketPort0 = 32" (or whatever) then the script fails.  (Hey, it actually happened to me.  We have very long uptimes.)  I don't see any other use of "dmesg" in MAKEDEV, so maybe this practice isn't encouraged.


>How-To-Repeat:
cd /dev
sh MAKEDEV cuaR31

Note: if you don't have a rocketport installed you might not get any output.  Change the dmesg command to "cat foo" where "foo" is a file that contains:

RocketPort = 32
RocketPort = 32
RocketPort = 32
RocketPort = 32

>Fix:
I fixed part 1 by passing the output of dmesg through "sort -u", but there has got to be a better way.  Maybe the script shouldn't try to be so smart and just create the entries.

Below is an ugly patch, but it works as long as you have rebooted recently.  Not usually a problem since MAKEDEV is usually run as part of initial setup of a machine.

# diff MAKEDEV.old MAKEDEV
1407c1407
<               dmesg | while read first rest; do
---
>               dmesg | /usr/bin/sort -u | while read first rest; do
1418c1418
<               dmesg | while read first bar ports rest; do
---
>               dmesg | /usr/bin/sort -u | while read first bar ports rest; do
1447c1447
<               dmesg | while read first rest; do
---
>               dmesg | /usr/bin/sort -u | while read first rest; do
1458c1458
<               dmesg | while read first bar ports rest; do
---
>               dmesg | /usr/bin/sort -u | while read first bar ports rest; do



>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200204231421.g3NELtI81692>