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 is actually happening as a result of a broken merge. The correct fix is: diff --git a/pm/functions.in b/pm/functions.in index 07fa468..f3bdc6c 100644 --- a/pm/functions.in +++ b/pm/functions.in @@ -135,8 +135,8 @@ run_hooks() " IFS="${nifs}" # tolerate spaces in filenames. [ "$3" = "reverse" ] && sort="sort -r" - for base in $(for f in "$syshooks/"*[!~] "$phooks/"*[!~]; - do [ -O "$f" ] && echo ${f##*/} ; done | sort | uniq) ; + for base in $(IFS="${oifs}"; for f in "$syshooks/"*[!~] "$phooks/"*[!~]; + do [ -O "$f" ] && echo ${f##*/} ; done | $sort | uniq) ; do if [ -f "$syshooks/$base" ]; then hook="$syshooks/$base" -- I will commit this fix to the freedesktop.org upstream.
Fix pushed to fd.o git repository.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.