NetBSD Problem Report #36733

From jmmv@netbsd.org  Sun Aug  5 14:04:28 2007
Return-Path: <jmmv@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 5B4A063BAB3
	for <gnats-bugs@gnats.NetBSD.org>; Sun,  5 Aug 2007 14:04:28 +0000 (UTC)
Message-Id: <20070805140428.5070263B1D2@mail.netbsd.org>
Date: Sun,  5 Aug 2007 14:04:28 +0000 (UTC)
From: jmmv@NetBSD.org
Reply-To: jmmv@NetBSD.org
To: gnats-bugs@NetBSD.org
Subject: ofctl(8) breaks due to an assertion
X-Send-Pr-Version: 3.95

>Number:         36733
>Category:       port-shark
>Synopsis:       ofctl(8) breaks due to an assertion
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    port-shark-maintainer
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 05 14:05:00 +0000 2007
>Closed-Date:    Mon May 18 05:52:43 +0000 2009
>Last-Modified:  Mon May 18 05:55:01 +0000 2009
>Originator:     Julio M. Merino Vidal
>Release:        NetBSD 4.99.26
>Organization:

>Environment:


System: NetBSD sphinx 4.99.26 NetBSD 4.99.26 (SPHINX) #25: Sun Aug 5 15:14:13 CEST 2007 jmmv@calypso.home.network:/Volumes/NetBSD/obj.shark/Volumes/NetBSD/src/sys/arch/shark/compile/SPHINX shark
Architecture: arm
Machine: shark
>Description:
	When running 'ofctl' without arguments on NetBSD/shark 4.99.26,
	the command aborts quickly due to a failed assertion.  Running the
	utility with the -p flag works correctly though.  This is (I believe)
	because the root node does not have a name (it is empty) but the
	code thinks it should have one.

	Here goes the output:

# ofctl
assertion "len > 0" failed: file "/Volumes/NetBSD/src/usr.sbin/ofctl/ofctl.c", line 562, function "ofname"
[Caching 50 nodes and 306 properties]
#

	The binary is:

/usr/sbin/ofctl:
     $NetBSD: crt0.c,v 1.6 2002/01/01 01:31:06 thorpej Exp $
     $NetBSD: ofctl.c,v 1.7 2007/08/05 13:52:44 jmmv Exp $

	And the gdb session:

# gdb ofctl
GNU gdb 6.5
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "arm--netbsdelf"...(no debugging symbols found)

(gdb) run
Starting program: /usr/sbin/ofctl 
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
assertion "len > 0" failed: file "/Volumes/NetBSD/src/usr.sbin/ofctl/ofctl.c", line 562, function "ofname"
[Caching 50 nodes and 306 properties]

Program received signal SIGABRT, Aborted.
0x200981f0 in kill () from /usr/lib/libc.so.12
(gdb) bt
#0  0x200981f0 in kill () from /usr/lib/libc.so.12
#1  0x2014a950 in abort () from /usr/lib/libc.so.12
#2  0x20104da8 in __assert13 () from /usr/lib/libc.so.12
#3  0x00009ea8 in ofname ()
#4  0x0000a868 in oflist ()
#5  0x0000ae58 in main ()
(gdb) kill
Kill the program being debugged? (y or n) (gdb) quit
#

>How-To-Repeat:
	Simply run 'ofctl' under NetBSD/shark.  I don't know if this is
	reproducible on other platforms with OpenFirmware, hence why I'm
	filing this in the port-shark category.  If confirmed on other
	platforms, reclassify under 'bin'.

>Fix:
	Properly handle the root node.  Need to understand how it is
	working on other platforms first, assuming it not fails there too.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: mrg@NetBSD.org
State-Changed-When: Mon, 18 May 2009 05:52:43 +0000
State-Changed-Why:
i fixed it.  shark OFW looks out of spec, but it's better for ofctl to be
liberal in what it accepts...


From: matthew green <mrg@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/36733 CVS commit: src/usr.sbin/ofctl
Date: Mon, 18 May 2009 05:51:53 +0000

 Module Name:	src
 Committed By:	mrg
 Date:		Mon May 18 05:51:53 UTC 2009

 Modified Files:
 	src/usr.sbin/ofctl: ofctl.c

 Log Message:
 if there is no "name" properly, don't assert(), pretend it is empty.
 now "ofctl" works on the shark.  fixes PR#36733.


 To generate a diff of this commit:
 cvs rdiff -u -r1.10 -r1.11 src/usr.sbin/ofctl/ofctl.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.