Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 235930 - bad wildcard handling
Summary: bad wildcard handling
Keywords:
Status: CLOSED DUPLICATE of bug 302401
Alias: None
Product: Fedora
Classification: Fedora
Component: pm-utils
Version: rawhide
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Till Maas
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-04-10 20:55 UTC by David Woodhouse
Modified: 2007-12-24 12:41 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2007-12-24 12:41:09 UTC


Attachments (Terms of Use)

Description David Woodhouse 2007-04-10 20:55:01 UTC
find_sleepd_file() in /usr/lib/pm-utils/functions has the following:

find_sleepd_files()
{
        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 15:18:06 UTC
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 19:51:08 UTC
shopt -s nullglob seems to be the best option here.

Comment 3 Till Maas 2007-12-24 12:41:09 UTC

*** 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.