Bug 235930 - bad wildcard handling
bad wildcard handling
Status: CLOSED DUPLICATE of bug 302401
Product: Fedora
Classification: Fedora
Component: pm-utils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Till Maas
Depends On:
  Show dependency treegraph
Reported: 2007-04-10 16:55 EDT by David Woodhouse
Modified: 2007-12-24 07:41 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2007-12-24 07:41:09 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description David Woodhouse 2007-04-10 16:55:01 EDT
find_sleepd_file() in /usr/lib/pm-utils/functions has the following:

        flist="/etc/pm/sleep.d/*[^~] /usr/lib/pm-utils/sleep.d/*[^~]"
        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... :)
Comment 1 Till Maas 2007-09-03 11:18:06 EDT
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)"
Comment 2 Till Maas 2007-09-24 15:51:08 EDT
shopt -s nullglob seems to be the best option here.
Comment 3 Till Maas 2007-12-24 07:41:09 EST

*** This bug has been marked as a duplicate of 302401 ***

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