NetBSD Problem Report #47706

From www@NetBSD.org  Sat Mar 30 12:01:16 2013
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 8464963F34D
	for <gnats-bugs@gnats.NetBSD.org>; Sat, 30 Mar 2013 12:01:16 +0000 (UTC)
Message-Id: <20130330120115.8236B63F34D@www.NetBSD.org>
Date: Sat, 30 Mar 2013 12:01:15 +0000 (UTC)
From: o.vd.linden@quicknet.nl
Reply-To: o.vd.linden@quicknet.nl
To: gnats-bugs@NetBSD.org
Subject: devel/cpuflags fails to work
X-Send-Pr-Version: www-1.0

>Number:         47706
>Category:       pkg
>Synopsis:       devel/cpuflags fails to work
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    abs
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Mar 30 12:05:00 +0000 2013
>Last-Modified:  Tue Apr 02 18:52:45 +0000 2013
>Originator:     Onno van der Linden
>Release:        NetBSD 6.99.18
>Organization:
>Environment:
NetBSD sheep 6.99.18 NetBSD 6.99.18 (SHEEP) #3: Sun Mar 24 16:27:05 MET 2013  onno@sheep:/usr/src/sys/arch/i386/compile/SHEEP i386
>Description:
devel/cpuflags responds with
eval: 1: Syntax error: word unexpected (expecting ")")
>How-To-Repeat:
install and run devel/cpuflags from pkgsrc
>Fix:
Adding a -x to /bin/sh at the top of /usr/pkg/bin/cpuflags shows

eval 'cpu_name=""Intel(R) Pentium(R) 4 CPU 2.26GHz""
[ multiple cpu_feature_* lines skipped]
cpu_feature_SS=1' 

Possible fixes
1) in subr_NetBSD of the cpuflags package
- remove the inside double quotes
- escape the inside double quotes
or
2) fix the shell ??


>Release-Note:

>Audit-Trail:
From: Onno van der Linden <o.vd.linden@quicknet.nl>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/47706
Date: Sat, 30 Mar 2013 15:28:36 +0100

 Here's a fix. The first part fixes the double quote problem
 which eval doesn't like.  The second part is to workaround
 the cpuctl output format containing a ( and a ) which
 eval doesn't like as well.


 --- /usr/pkgsrc/devel/cpuflags/files/subr_NetBSD	2010-12-05 20:12:11.000000000 +0100
 +++ /usr/pkg/share/cpuflags/subr_NetBSD	2013-03-30 15:23:40.000000000 +0100
 @@ -44,7 +44,7 @@
      #      cpu_name="NAME" taken from the first cpu0: line
      #      cpu_brand="BRAND" the CPU branding string
      echo "$cpu_details" | $AWK '
 -    { if (/cpu0:/ && !n) { sub("cpu0: ",""); n=1; print "cpu_name=\""$0"\"" } }
 +    { if (/cpu0:/ && !n) { sub("cpu0: ",""); n=1; print "cpu_name=\\\""$0 "\\\"" } }
      /cpu0: ".*"/ { sub("[^\"]*", ""); print "cpu_brand="$0 }
      /cpu0: features/ {
  	sub(".*<","");
 @@ -55,6 +55,8 @@
  	    print "cpu_feature_"features[f]"=1";
  	}
      /cpu0: family/ {
 +	sub("[(]","");
 +	sub("[)]","");
  	for (i = 2; i < NF; i = i + 2) {
  	    f=$(i+1);
  	    sub(/^0/, "", f);

Responsible-Changed-From-To: pkg-manager->abs
Responsible-Changed-By: hauke@NetBSD.org
Responsible-Changed-When: Tue, 02 Apr 2013 18:52:45 +0000
Responsible-Changed-Why:
Over to maintainer.


>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.