Bug 97006 - apropos 'stdio functions' gives 'unary operator expected'
Summary: apropos 'stdio functions' gives 'unary operator expected'
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: man
Version: 9
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Eido Inoue
QA Contact: Ben Levenson
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2003-06-08 16:56 UTC by Edward J. Huff
Modified: 2007-04-18 16:54 UTC (History)
0 users

Fixed In Version: 1.6k-11
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2003-10-09 19:51:25 UTC
Embargoed:


Attachments (Terms of Use)
Patch to /usr/bin/apropos to clean it up (1.95 KB, patch)
2003-06-08 20:19 UTC, Edward J. Huff
no flags Details | Diff

Description Edward J. Huff 2003-06-08 16:56:34 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
An unquoted expansion of $1 in the /usr/bin/apropos script causes various
cryptic error messages when the string "$1" occurs somewhere in the whatis file.

apropos 'foo bar' does not, because "foo bar" does not appear in whatis.


Version-Release number of selected component (if applicable):
man-1.5k-6

How reproducible:
Always

Steps to Reproduce:
1.$ apropos 'stdio functions'
2.
3.
    

Actual Results:  $ apropos 'stdio functions'
/usr/bin/apropos: line 96: [: stdio: unary operator expected

Expected Results:  $ ./apropos 'stdio functions'
*_unlocked [unlocked_stdio] (3)  - non-locking stdio functions


Additional info:

diff -Naur /usr/bin/apropos ./apropos
--- /usr/bin/apropos	2003-02-10 10:20:16.000000000 -0500
+++ ./apropos	2003-06-08 12:26:02.000000000 -0400
@@ -93,7 +93,7 @@
     exit
 fi
 
-while [ $1 ]
+while [ "$1" ]
 do
     for i in $nothing
     do

Comment 1 Edward J. Huff 2003-06-08 20:19:01 UTC
Created attachment 92265 [details]
Patch to /usr/bin/apropos to clean it up

apropos has a lot of junk in it, and does not support the -- option.

This removes the dead code, cleans up the quoting, and adds support
for --.

Comment 2 Edward J. Huff 2003-06-08 20:21:55 UTC
There is a bug introduced by a RedHat patch:  
-    for d in /var/cache/man /usr/lib
+    for d in /var/cache/man $manpath /usr/lib

In one copy of the for statement, RedHat adds /var/cache/man,
in the other copy, it deletes the $manpath.

This script has a lot of dead code in it.

The args variable is constructed but never used.

Since the pager output was commented out, the whole loop which
prescans to see if there are any results could be removed.

I added a patch which fixes the above.



Comment 3 Eido Inoue 2003-08-08 17:04:49 UTC
Nice patch. I've redone it so the patch works on the src tarball rather than the
inplace script, and added some minor grep options for non-US locales.

Will include in the next version.

Thanks!


Note You need to log in before you can comment on or make changes to this bug.