From castor@geocast.net Sun Feb 28 11:56:25 1999
Return-Path: <castor@geocast.net>
Received: from geo.geocast.net (geo.geocast.net [128.177.240.120])
	by hub.freebsd.org (Postfix) with ESMTP id 0206C15272
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Feb 1999 11:56:24 -0800 (PST)
	(envelope-from castor@geocast.net)
Received: from localhost (castor@localhost)
	by geo.geocast.net (8.8.8/8.8.8) with ESMTP id LAA18890
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Feb 1999 11:56:32 -0800 (PST)
Message-Id: <Pine.GSO.4.03.9902281155400.18887-100000@geo.geocast.net>
Date: Sun, 28 Feb 1999 11:56:32 -0800 (PST)
From: Castor Fu <castor@geocast.net>
To: FreeBSD-gnats-submit@freebsd.org
Subject: pciconf -l generates output incompatible with pciconf -r

>Number:         10312
>Category:       bin
>Synopsis:       pciconf -l generates output incompatible with pciconf -r
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    ken
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 28 12:00:01 PST 1999
>Closed-Date:    Fri Jun 20 17:01:20 PDT 2003
>Last-Modified:  Fri Jun 20 17:01:20 PDT 2003
>Originator:     Castor Fu
>Release:        FreeBSD 3.1-RELEASE i386
>Organization:
Geocast Network Systems
>Environment:

	FreeBSD 3.1-RELEASE but the problem has been verified to occur with 
	the pciconf which is in RELENG_3 tag.

>Description:

	The change in the format of 'pciconf -l' to identify the 
	device associated with each card produces output where the
	first column of output can no longer be used as a selector
	for 'pciconf -[rwa] <selector>'.  This contradicts the
	manual page and may cause various scripts to fail.

>How-To-Repeat:

clf-0# pciconf -l
chip0@pci0:0:0: class=0x060000 card=0x00000000 chip=0x71008086 rev=0x01 hdr=0x00
chip1@pci0:1:0: class=0x060100 card=0x00000000 chip=0x71108086 rev=0x01 hdr=0x00
ide_pci0@pci0:1:1:      class=0x010180 card=0x00000000 chip=0x71118086 rev=0x01 hdr=0x00
uhci0@pci0:1:2: class=0x0c0300 card=0x00000000 chip=0x71128086 rev=0x01 hdr=0x00
chip2@pci0:1:3: class=0x068000 card=0x00000000 chip=0x71138086 rev=0x01 hdr=0x00
vga0@pci0:9:0:  class=0x030000 card=0x8a015333 chip=0x8a015333 rev=0x01 hdr=0x00
bktr0@pci0:10:0:        class=0x040000 card=0x00000000 chip=0x0350109e rev=0x12 hdr=0x00
de0@pci0:11:0:  class=0x020000 card=0x11001385 chip=0x00091011 rev=0x22 hdr=0x00
clf-0# pciconf -r de0@pci0:11:0: 12
pciconf: cannot parse selector de0@pci0:11:0:

>Fix:
	
Index: pciconf.c
===================================================================
RCS file: /cvs/src/usr.sbin/pciconf/pciconf.c,v
retrieving revision 1.7
diff -r1.7 pciconf.c
193c193,194
< 	char *ep = (char*) str;
---
> 	char *ep = strchr(str, '@');
> 	char *epbase;
195c196,203
< 	
---
> 
> 	if  (ep == 0) {
> 		ep = (char *) str;
> 	} else {
> 		ep++;
> 	}
> 	epbase = ep;
> 
207a216,217
> 		if (*ep == ':')
> 			ep++;
209,211c219
< 	if (*ep == ':')
< 		ep++;
< 	if (*ep || ep == str)
---
> 	if (*ep || ep == epbase)


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->ken 
Responsible-Changed-By: ken 
Responsible-Changed-When: Wed Mar 3 23:37:37 PST 1999 
Responsible-Changed-Why:  
Thanks for the bug report.  Since I wrote the code in question, I'll 
take care of this PR.  I probably won't be able to get around to it for 
a little bit, though. 
State-Changed-From-To: open->closed 
State-Changed-By: jmg 
State-Changed-When: Fri Jun 20 16:59:39 PDT 2003 
State-Changed-Why:  
fixed in v1.19 of src/usr.sbin/pciconf/pciconf.c 

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