[Pm-utils] [Fwd: [Bug 14560] New: resume scripts run in incorrect sort order]
Victor Lowther
victor.lowther at gmail.com
Tue Feb 19 18:12:49 PST 2008
On Tue, Feb 19, 2008 at 10:46:11AM +0000, Richard Hughes wrote:
> http://bugs.freedesktop.org/show_bug.cgi?id=14560
>
> Summary: resume scripts run in incorrect sort order
> Product: pm-utils
> Version: unspecified
> Platform: Other
> OS/Version: All
> Status: NEW
> Severity: normal
> Priority: medium
> Component: General
> AssignedTo: richard at hughsie.com
> ReportedBy: liblit at acm.org
>
>
> The scripts in /usr/lib/pm-utils/sleep.d (or some similar location) are
> supposed to run in reverse order when resuming from suspend. However, they
> actually run in the same order. This causes problems with several
> order-sensitive scripts in that directory, such as 05led and 95led.
>
> The bug is in function pm_main from the /usr/lib/pm-utils/functions script. It
> sets local variable $sort to either "sort" or "sort -r" depending on the
> desired order. However, the list of script names is then piped through "sort",
> rather than "$sort". Thus, setting $sort to "sort -r" has no affect on the
> ordering.
>
> Suggested fix: near line 139 of /usr/lib/pm-utils/functions, change this:
>
> do [ -O "$f" ] && echo ${f##*/} ; done | sort | uniq) ;
>
> to this:
>
> do [ -O "$f" ] && echo ${f##*/} ; done | eval $sort | uniq) ;
>
> Note that the "eval" is necessary because otherwise the shell will try to find
> an executable command named "sort -r" rather than running "sort" with "-r" as
> an argument.
This bug happened because of a thinko when merging in the run_hooks
simplifications. I have pushed what should have been merged to the fd.o
git repository. The pushed code runs the hooks in the correct order.
--
Victor Lowther
Ubuntu Certified Professional
More information about the Pm-utils
mailing list