Bug 302401 - Several misbehaviors in pm-utils scripts
Summary: Several misbehaviors in pm-utils scripts
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: pm-utils
Version: 7
Hardware: All
OS: Linux
low
high
Target Milestone: ---
Assignee: Till Maas
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
: 235930 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-09-23 22:45 UTC by Ben Slusky
Modified: 2008-06-13 02:20 UTC (History)
3 users (show)

Fixed In Version: 0.99.4-19.fc8
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-06-13 02:20:18 UTC
Type: ---


Attachments (Terms of Use)

Description Ben Slusky 2007-09-23 22:45:29 UTC
Description of problem:

 1. In /usr/lib/pm-utils/functions, lines 26 and 62;
       /usr/sbin/pm-powersave, line 29:
    These functions use globs to build up a list of files, which are
    subsequently processed by basename. If the directory (i.e. one of
    /etc/pm/{config,power,sleep}.d) is empty, then the glob will remain
    unchanged, basename will turn it into "*", and in each case the
    subsequent for-loop will run over all files in the current directory
    (which I guess is probably /).

    Use "shopt -s nullglob" to prevent this.

 2. In /usr/lib/pm-utils/functions, line 63;
       /usr/sbin/pm-powersave, line 30:
    These functions seem to return a list of files in /etc/pm/$FOO.d
    and /usr/lib/pm-utils/$FOO.d, with files in the former directory
    masking files in the latter directory. However, this is not what
    actually happens.  If a file called $BAR exists in both of those
    directories, then the functions will list /etc/pm/$FOO.d/$BAR twice.
    In each case this means that /etc/pm/$FOO.d/$BAR will be run twice,
    which is probably not the desired behavior.

    Change "| sort -n" to "| sort -un" to fix this.

 3. In /usr/lib/pm-utils/functions, lines 26-27:
	...
	for cfg in $cfgs ; do
		[ -f $cfgs ] || continue
		...
    Clearly line 27 should read "[ -f $cfg ] || continue".

Version-Release number of selected component (if applicable):
pm-utils-0.99.3-6.fc7

How reproducible:

 Trivially.

Comment 1 Till Maas 2007-09-24 19:15:21 UTC
Nr. 3 will be fixed with the next push to stable, I will look into the other
issues later this week.

Comment 2 Ben Slusky 2007-09-25 13:47:10 UTC
Re: #2 -- Oops, "sort -un" is not right either. I think "sort -n | uniq" is needed.

Comment 3 Till Maas 2007-09-25 19:13:44 UTC
(In reply to comment #2)
> Re: #2 -- Oops, "sort -un" is not right either. I think "sort -n | uniq" is
needed.

What is the difference?

Comment 4 Ben Slusky 2007-09-25 22:18:19 UTC
(In reply to comment #3)
> (In reply to comment #2)
> > Re: #2 -- Oops, "sort -un" is not right either. I think "sort -n | uniq" is
> needed.
> 
> What is the difference?

"sort -un" only counts the numeric part when determining uniqueness.

    $ { echo 1foo; echo 1bar; echo 2baz; } |sort -un
    1foo
    2baz


Comment 5 Till Maas 2007-12-24 12:41:11 UTC
*** Bug 235930 has been marked as a duplicate of this bug. ***

Comment 6 Till Maas 2007-12-31 00:43:09 UTC
Fixed in Rawhide and Upstream, it will go in updates-testing, when there is no
negative feedback.

Comment 7 Richard Hughes 2008-04-08 07:56:31 UTC
Is this now fixed upstream (we did a rewrite..)?
http://pm-utils.freedesktop.org/wiki/

Comment 8 Till Maas 2008-04-08 08:10:10 UTC
(In reply to comment #7)
> Is this now fixed upstream (we did a rewrite..)?

Yes, it is (see comment:7) ;-)



Comment 9 Fedora Update System 2008-04-19 13:46:06 UTC
pm-utils-0.99.4-17.fc7 has been submitted as an update for Fedora 7

Comment 10 Fedora Update System 2008-04-19 13:46:34 UTC
pm-utils-0.99.4-17.fc8 has been submitted as an update for Fedora 8

Comment 11 Fedora Update System 2008-04-22 22:38:06 UTC
pm-utils-0.99.4-17.fc7 has been pushed to the Fedora 7 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update pm-utils'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F7/FEDORA-2008-3246

Comment 12 Bug Zapper 2008-05-14 14:27:48 UTC
This message is a reminder that Fedora 7 is nearing the end of life. Approximately 30 (thirty) days from now Fedora will stop maintaining and issuing updates for Fedora 7. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '7'.

Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 7's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 7 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora please change the 'version' of this bug. If you are unable to change the version, please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete. If possible, it is recommended that you try the newest available Fedora distribution to see if your bug still exists.

Please read the Release Notes for the newest Fedora distribution to make sure it will meet your needs:
http://docs.fedoraproject.org/release-notes/

The process we are following is described here: http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 13 Fedora Update System 2008-05-18 17:24:08 UTC
pm-utils-0.99.4-18.fc8 has been submitted as an update for Fedora 8

Comment 14 Ben Slusky 2008-06-09 00:23:02 UTC
Unfortunately I can't test pm-utils-0.99.4-17.fc7 because I've upgraded, but it
looks fixed to me. I also can't test pm-utils-0.99.4-18.fc8 because it isn't in
the testing repo. :-/

Comment 15 Fedora Update System 2008-06-09 22:28:13 UTC
pm-utils-0.99.4-19.fc8 has been submitted as an update for Fedora 8

Comment 16 Till Maas 2008-06-09 23:12:50 UTC
(In reply to comment #14)
> Unfortunately I can't test pm-utils-0.99.4-17.fc7 because I've upgraded, but it
> looks fixed to me. I also can't test pm-utils-0.99.4-18.fc8 because it isn't in
> the testing repo. :-/

There was another bug I wanted to fix before the package goes to stable, the -19
build should soon be in the testing repo.

Comment 17 Fedora Update System 2008-06-13 02:20:06 UTC
pm-utils-0.99.4-19.fc8 has been pushed to the Fedora 8 stable repository.  If problems still persist, please make note of it in this bug report.


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