Red Hat Bugzilla – Bug 459823
`` expansion in /etc/profile.d *.sh files do not provide correct number of parameters to '[' builtin
Last modified: 2013-04-12 15:51:19 EDT
Description of problem:
/etc/profile.d/*sh files for krb5-devel, krb5-workstation, vim-enhanced, and probably other packages make the incorrect assumption that `id -u` always returns something other than ''
Version-Release number of selected component (if applicable):
See bug 448014 for one set of events causing the bug to be reproduced.
Steps to Reproduce:
.sh file errors out with
'-bash: [: -le: unary operator expected'
The root cause of this bug are incorrectly written .sh files.
They use the construct
[ `/usr/bin/id -u` = 0 ]
[ `/usr/bin/id -u` -le 100 ]
The proper construct to guarantee enough parameters to the '[' shell builtin is
[ "$(/usr/bin/id -u)" = 0]
[ "$(/usr/bin/id -u" -le 100 ]
This construct won't work either as p.e. '-le' doesn't accept an empty string
as an integer.
The correct fix is to check the value of id -u before using it. Please note that
I'm not setting the alias for security reasons when id -u returns nothing.
[ "$tmpid" = "" ] && tmpid=0
[ $tmpid -le 100 ] && return
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.