From garys@opusnet.com  Wed Aug  3 15:18:45 2005
Return-Path: <garys@opusnet.com>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 81BC816A41F
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  3 Aug 2005 15:18:45 +0000 (GMT)
	(envelope-from garys@opusnet.com)
Received: from opusnet.com (mail.opusnet.com [209.210.200.6])
	by mx1.FreeBSD.org (Postfix) with ESMTP id EE2A943D5E
	for <FreeBSD-gnats-submit@freebsd.org>; Wed,  3 Aug 2005 15:18:42 +0000 (GMT)
	(envelope-from garys@opusnet.com)
Received: from localhost.localhost [70.98.246.232] by opusnet.com with ESMTP
  (SMTPD32-8.05) id A051901600EA; Wed, 03 Aug 2005 08:18:41 -0700
Received: from localhost.localhost (localhost.localhost [127.0.0.1])
	by localhost.localhost (8.13.3/8.13.3) with ESMTP id j73FKJIO006792
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 3 Aug 2005 08:20:19 -0700 (PDT)
	(envelope-from garys@opusnet.com)
Received: (from jojo@localhost)
	by localhost.localhost (8.13.3/8.13.3/Submit) id j73FKErs006791;
	Wed, 3 Aug 2005 08:20:14 -0700 (PDT)
	(envelope-from garys@opusnet.com)
Message-Id: <zj8xzj2gk1.xzj@mail.opusnet.com>
Date: Wed, 03 Aug 2005 08:20:14 -0700
From: "Gary W. Swearingen" <garys@opusnet.com>
Reply-To: garys@opusnet.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: whatis(1) program burps on /bin/[
X-GNATS-Notify:

>Number:         84520
>Category:       bin
>Synopsis:       whatis(1) program burps on /bin/[
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Aug 03 15:20:06 GMT 2005
>Closed-Date:    Thu Oct 12 20:44:35 GMT 2006
>Last-Modified:  Thu Oct 12 20:44:35 GMT 2006
>Originator:     Gary W. Swearingen
>Release:        FreeBSD 5.4-RELEASE i386
>Organization:
none
>Environment:
n/a
>Description:
The "whatis"/"apropos" script doesn't handle the "/bin/[" program.

>How-To-Repeat:

$ /usr/bin/whatis [
grep: Unmatched [ or [^
[: nothing appropriate

$ /usr/bin/apropos [
grep: Unmatched [ or [^
[: nothing appropriate

>Fix:
patch gives this:

$ whatis [
 ihfc(4)                  - isdn4bsd ISA Cologne Chip HFC[-S][-SP] 2B[DS0] driver
 test(1), [(1)            - condition evaluation utility

$ apropos [
 ct(4)                    - WD33C93[ABC] based CBUS SCSI host adapter driver
 ihfc(4)                  - isdn4bsd ISA Cologne Chip HFC[-S][-SP] 2B[DS0] driver
 ndiscvt(8)               - convert Windows[rg] NDIS drivers for use with
 test(1), [(1)            - condition evaluation utility

I gave up after a serious try at developing a more general fix.

I'd normally use an "if", but the script seems to like "case" and
it does prepare for additional exceptional cases.


--- /usr/bin/whatis	Sun May  8 00:02:01 2005
+++ /tmp/whatis	Tue Aug  2 16:16:44 2005
@@ -84,6 +84,10 @@
 
 for manpage
 do
+        case "$manpage" in
+                '[') manpage='\[';;
+        esac
+
 	if grep -Ehi $grepopt -- "$manpage" $mandir; then :
 	else
         	echo "$manpage: nothing appropriate"
>Release-Note:
>Audit-Trail:

From: Stefan Farfeleder <stefanf@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: misc/84520: whatis(1) program burps on /bin/[
Date: Wed, 3 Aug 2005 22:25:23 +0200

 Apropos(1) admits that ``keyword'' is an ERE, so you're supposed to
 issue whatis '\['.  If we want to change the behaviour (which I doubt),
 I'd prefer using fgrep over your change.
State-Changed-From-To: open->closed 
State-Changed-By: ru 
State-Changed-When: Thu Oct 12 20:44:12 UTC 2006 
State-Changed-Why:  
What Stefan said. 

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