Bug 128405 - /usr/bin/apm --suspend and --standby can return 0 on failure
/usr/bin/apm --suspend and --standby can return 0 on failure
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: apmd (Show other bugs)
2
All Linux
medium Severity medium
: ---
: ---
Assigned To: Bill Nottingham
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2004-07-22 12:16 EDT by Paul Bolle
Modified: 2014-03-16 22:46 EDT (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-03-16 17:26:30 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
a quick hack to end this bug (354 bytes, patch)
2004-07-22 12:17 EDT, Paul Bolle
no flags Details | Diff

  None (edit)
Description Paul Bolle 2004-07-22 12:16:00 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040510

Description of problem:
When an ordinary user runs /usr/bin/apm --suspend (or --standby) this
operation will fail (with this error: "apm: Operation not permitted").
However apm still returns a 0.

Note that this confuses Gnome's Battery Charge Monitor. It won't give
an error altough the suspend action failed.

Version-Release number of selected component (if applicable):
apmd-3.0.2-22

How reproducible:
Always

Steps to Reproduce:
1. run /usr/binapm --suspend (or --standby) as an ordinary user
2. echo $?
3.

    

Actual Results:  apm: Operation not permitted
0


Expected Results:  apm: Operation not permitted
1

Additional info:

I'll attach a quick hack which seems to solve this bug.
Comment 1 Paul Bolle 2004-07-22 12:17:01 EDT
Created attachment 102149 [details]
a quick hack to end this bug
Comment 2 Ryan Beckes 2004-09-11 17:01:56 EDT
You can also fix this by installing sudo, use command visudo (as root)
to add the following line to the sudoers file...

%suspenders  localhost = NOPASSWD: /usr/bin/apm -s

anyone in the "suspenders" group can execute the following command as
root.

sudo /usr/bin/apm -s

this is useful in interfaces also since the NOPASSWD allows execution
without a password. See... 

%man sudoers 

...for more details.
Comment 3 Paul Bolle 2004-09-27 20:34:37 EDT
1) Ryan, thanks for commenting. However, this bug is not about getting
apm to work for ordinary users, but about returning the expected value
(1) when an ordinary user does run apm and causes an error.

2) I noticed that a recent version of Knoppix (3.4) included "apm
version 3.2.1". It has some updates I know of: an actually working
-M/--monitor option and the -M/--monitor option is even mentioned in
the manpage (I haven't checked this bugzilla for those bugs ...).

So it might be that this bug is fixed in apm version 3.2.1: does
anyone know where I can find the Knoppix (= debian?) sources of apm(d)
3.2.1 to check that?
Comment 4 Bill Nottingham 2005-03-16 17:26:30 EST
Added in 3.2.2-1 (and it's not fixed upstream, fwiw)

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