#1071610 pm-utils: with molly-guard, pm-suspend.no-molly-guard won't suspend

#1071610#5
Date:
2024-05-22 11:16:29 UTC
From:
To:
Dear Maintainer,


    * What led up to the situation?
      Install molly-guard:
       ii  molly-guard    0.8.4
    * What exactly did you do (or not do) that was effective (or
      ineffective)?
      With molly-guard installed, /sbin/pm-suspend is replaced:
      ~# ll /sbin/pm-suspend*
      lrwxrwxrwx 1 root root 30  9. Mär 22:38 /sbin/pm-suspend -> ../lib/molly-guard/molly-guard*
      lrwxrwxrwx 1 root root 30  9. Mär 22:38 /sbin/pm-suspend-hybrid -> ../lib/molly-guard/molly-guard*
      lrwxrwxrwx 1 root root 31 26. Jan 12:14 /sbin/pm-suspend-hybrid.no-molly-guard -> /usr/lib/pm-utils/bin/pm-action*
      lrwxrwxrwx 1 root root 31 26. Jan 12:14 /sbin/pm-suspend.no-molly-guard -> /usr/lib/pm-utils/bin/pm-action*

    * What was the outcome of this action?
      Calling /sbin/pm-suspend.no-molly-guard is not suspending the system.

    * What outcome did you expect instead?
      Calling /sbin/pm-suspend.no-molly-guard should suspend the system.

Rationale:
molly-guard will create symlinks upon installation. These symlinks may be
used in cirumstances. pm-action is not aware of those links and fails
to suspend.

With the patch supplied below pm-action is molly-guard-aware and the
/sbin/pm-suspend.no-molly-guard link is usable to suspend the system.

proposed PATCH:
--- /usr/lib/pm-utils/bin/pm-action     2024-05-22 10:25:03.506813817 +0200
+++ /usr/lib/pm-utils/bin/pm-action.bkp 2024-05-22 10:24:11.605425986 +0200
@@ -26,7 +26,7 @@

  # The rule here? Simplicity.
  export STASHNAME=pm-suspend
-export METHOD="$(echo ${0##*pm-} |tr - _)"
+export METHOD="$(echo ${0##*pm-} | sed 's/\.no-molly-guard//g' |tr - _)"
  . "/usr/lib/pm-utils/pm-functions"

  # return code tracking for when suspend fails