Bug 215824 - acpid check for gnome-power-manager running is racy
acpid check for gnome-power-manager running is racy
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: acpid (Show other bugs)
6
All Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
:
: 220361 (view as bug list)
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-11-15 17:10 EST by Michal Jaegermann
Modified: 2015-03-04 20:17 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2007-05-16 09:50:21 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michal Jaegermann 2006-11-15 17:10:33 EST
Description of problem:

In /etc/acpi/events/power.conf "action" is defined in the following way:

action=/bin/ps awwux \
 | /bin/grep gnome-power-manager | /bin/grep -qv grep \
 || /sbin/shutdown -h now

The problem with this is that if gnome-power-manager is _not_ running,
and /bin/ps will miss that grep, which happens if not that often,
then we will still get a status 0 from that pipeline while it should
be 1.

This action should look like this

 pgrep -f gnome-power-manager >/dev/null || /sbin/shutdown -h now

or, if mucking with /bin/ps is really preferable,
 
 /bin/ps awwux | /bin/grep -q [g]nome-power-manager \
   || /sbin/shutdown -h now

where both ways are not only correct but also simpler.

Version-Release number of selected component (if applicable):
acpid-1.0.4-5
Comment 1 Simon Goodall 2006-11-16 17:23:07 EST
I've been having a problem with this script. It's always powering off my machine
regardless of whether gnome power manager is running. Manually running the command;

/bin/ps awwux | /bin/grep gnome-power-manager | /bin/grep -qv grep || echo "Oops"

will yeild no output. However disabling the script causes gnome-power-manager to
close (but this is a separate bug).
Comment 2 Michal Jaegermann 2006-11-16 18:30:12 EST
> Manually running ... will yeild no output.

Well, one would hope so. :-) This thing tries to say, in a complicated
manner, "if gnome-power-manager is running then, and only then, do not
bother with the stuff at the end of this line".  Usually it even manages
to do that. :-)

When gnome-power-manager is running then it appears that handling of
a power-button event is supposed to happen there but see bug 215822
(sigh, I am eating traling letters in words when typing).
Comment 3 Phil Knirsch 2007-05-16 09:50:21 EDT
That sounds like a real neat fix. I got some reports about this already, but
most were rather unspecific.

I'll include the fix in the next build of acpid.

Thanks,

Read ya, Phil
Comment 4 Phil Knirsch 2007-05-16 09:56:30 EDT
*** Bug 220361 has been marked as a duplicate of this bug. ***

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