Red Hat Bugzilla – Bug 97006
apropos 'stdio functions' gives 'unary operator expected'
Last modified: 2007-04-18 12:54:41 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):
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
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
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
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.
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.