Bug 97006 - apropos 'stdio functions' gives 'unary operator expected'
apropos 'stdio functions' gives 'unary operator expected'
Product: Red Hat Linux
Classification: Retired
Component: man (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Eido Inoue
Ben Levenson
Depends On:
  Show dependency treegraph
Reported: 2003-06-08 12:56 EDT by Edward J. Huff
Modified: 2007-04-18 12:54 EDT (History)
0 users

See Also:
Fixed In Version: 1.6k-11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-10-09 15:51:25 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

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

  None (edit)
Description Edward J. Huff 2003-06-08 12:56:34 EDT
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):

How reproducible:

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

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 @@
-while [ $1 ]
+while [ "$1" ]
     for i in $nothing
Comment 1 Edward J. Huff 2003-06-08 16:19:01 EDT
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 16:21:55 EDT
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 13:04:49 EDT
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.


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