Launchpad has imported 2 comments from the remote bug at https://bugs.freedesktop.org/show_bug.cgi?id=32210.
If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://help.launchpad.net/InterBugTracking. ------------------------------------------------------------------------ On 2010-12-07T20:02:35+00:00 ariel cornejo wrote: Created attachment 40891 patch for pm-functions.in Since 1.4.0, _run_hook calls a log() after running the hook, and thus loses the hook exit status: 199 hook_ok "$1" && "$@" 200 log "" 201 log -n "$*: " 202 hook_exit_status $? && LAST_HOOK="${1##*/}" || inhibit I attached a simple patch that seems to fix it. This is important because e.g. a script that unmounts SD/MMC cards before suspending cannot inhibit it if the card is busy (see https://help.ubuntu.com/community/AspireOne/Ubuntu9.10?action=recall&rev=69). Regards, Ariel Reply at: https://bugs.launchpad.net/ubuntu/+source/pm- utils/+bug/665651/comments/2 ------------------------------------------------------------------------ On 2010-12-22T04:18:35+00:00 ariel cornejo wrote: Umm, I hoped there would be some kind of reply by now. Should I learn git and try to submit the patch there? Reply at: https://bugs.launchpad.net/ubuntu/+source/pm- utils/+bug/665651/comments/3 -- You received this bug notification because you are a member of Desktop Packages, which is subscribed to pm-utils in Ubuntu. https://bugs.launchpad.net/bugs/665651 Title: pm-utils does not follow requests to inhibit suspend/hibernate from scripts in /etc/pm/sleep.d Status in pm-utils: Confirmed Status in “pm-utils” package in Ubuntu: Fix Released Status in “pm-utils” package in Debian: Fix Released Bug description: Binary package hint: pm-utils 1) ubuntu version Description: Ubuntu 10.10 Release: 10.10 2) package version: pm-utils: Instalado: 1.4.1-3 Candidato: 1.4.1-3 Tabela de versão: *** 1.4.1-3 0 500 http://br.archive.ubuntu.com/ubuntu/ maverick/main amd64 Packages 100 /var/lib/dpkg/status 3) If a script in /etc/pm/sleep.d returns a non-zero value upon requests to suspend or hibernate, the suspend/hibernate process should be aborted. 4) The system ignores the return value and supends/hibernates anyhow. In order to reproduce the bug just drop the 00_avoid_suspend script in /etc/pm/sleep.d, make it executable and try to sleep. The system should refuse to sleep but, at least here, it doesn't. The problems seems to be in the _run_hook() function defined in file /usr/lib/pm-utils/pm-fuctions. This is the function that calls the scripts in the /etc/pm/sleep.d directory. After calling the script, _run_hook calls the function log twice before checking the script return value. It seems that the return value is being set back to 0 in these calls to log (but I am no bash expert). To walk around I just added a line to store the script return value in a temporary variable and used that variable after the log calls to check the original result. Now it seems to work. My current _run_hook function looks like this: _run_hook() { # $1 = hook to run # rest of args passed to hook unchanged. log "Running hook $*:" hook_ok "$1" && "$@" status=$? log "" log -n "$*: " hook_exit_status $status && LAST_HOOK="${1##*/}" || inhibit } Since I am no bash expert, I can not assure that this is a proper solution, but it works here. To manage notifications about this bug go to: https://bugs.launchpad.net/pm-utils/+bug/665651/+subscriptions -- Mailing list: https://launchpad.net/~desktop-packages Post to : [email protected] Unsubscribe : https://launchpad.net/~desktop-packages More help : https://help.launchpad.net/ListHelp

