Red Hat Bugzilla – Bug 235930
bad wildcard handling
Last modified: 2007-12-24 07:41:09 EST
find_sleepd_file() in /usr/lib/pm-utils/functions has the following:
bases=$(for file in $flist ; do echo $(basename $file) ; done | sort -n)
If /etc/pm/sleep.d is empty, then $flist is, literally, "/etc/pm/sleep.d/*[^~]".
We go through the 'for file in $flist' loop precisely once, with $file set to
the same. $(basename $file) evaluates to '*[^~]' and the 'echo' command prints
the filename of every file in the current directory.
Let's just hope that the first filename printed by echo isn't the name of a
program which will do nasty things... :)
Do you have a suggestion, how to fix this? Would this be ok?
flist="$(/bin/ls /etc/pm/sleep.d/*[^~] /usr/lib/pm-utils/sleep.d/*[^~] 2>/dev/null)"
shopt -s nullglob seems to be the best option here.
*** This bug has been marked as a duplicate of 302401 ***