Bug 823539 - init script failure for unprivileges / nonroot user
init script failure for unprivileges / nonroot user
Status: CLOSED DUPLICATE of bug 824297
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: tog-pegasus (Show other bugs)
6.2
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Vitezslav Crhonek
qe-baseos-daemons
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-05-21 09:37 EDT by Petr Sklenar
Modified: 2012-05-29 07:43 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-05-29 07:43:00 EDT
Type: Bug
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 Petr Sklenar 2012-05-21 09:37:17 EDT
init script failure for unprivileges / nonroot user

Version-Release number of selected component (if applicable):
tog-pegasus-2.11.0-3.el6:

How reproducible:
deterministic 

Description of problem:
try to do any operations with non root:

tog-pegasus-2.11.0-3.el6
# su - superman -c "service tog-pegasus status; echo $?"
env: /etc/init.d/tog-pegasus: Permission denied
0
# su - superman -c "service tog-pegasus stop; echo $?"
env: /etc/init.d/tog-pegasus: Permission denied
0
# su - superman -c "service tog-pegasus start; echo $?"
env: /etc/init.d/tog-pegasus: Permission denied
0
# su - superman -c "service tog-pegasus I_dont_exists; echo $?"
env: /etc/init.d/tog-pegasus: Permission denied
0

  
Actual results:
return code 0

Expected results:
return code 4 during failure
could `service X status` say the status ?

Additional info:
Comment 2 RHEL Product and Program Management 2012-05-24 23:45:54 EDT
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 3 Vitezslav Crhonek 2012-05-28 10:45:32 EDT
This bug is consequence of bz#824297. I suggest to close it as DUPLICATE.

Change init script mode bits to correct value with:
# chmod o+rx /etc/init.d/tog-pegasus

And then try to do operations as non root, everything should work correctly (even 'service X status' will say status).
Comment 4 Vitezslav Crhonek 2012-05-29 06:41:41 EDT
Also note, that reproducer is not correct, the "$?" is expanded before it is send tu "su -c" - it will be zero all the time:

# su - vcrhonek -c "false; echo $?"
0
# set -x
# su - vcrhonek -c "false; echo $?"
+ su - vcrhonek -c 'false; echo 0'
0

The reproducer should look like:
# su - vcrhonek -c 'false; echo $?'
+ su - vcrhonek -c 'false; echo $?'
1
Comment 5 Vitezslav Crhonek 2012-05-29 06:44:24 EDT
(In reply to comment #4)
> it will be zero all the time:

More precisely, it will be the exit status of the previous command.
Comment 6 Petr Sklenar 2012-05-29 07:00:00 EDT
(In reply to comment #5)
> (In reply to comment #4)
> > it will be zero all the time:
> 
> More precisely, it will be the exit status of the previous command.
right you are, qa can not miss with \' and \"

Test looks OK:
http://pkgs.devel.redhat.com/cgit/tests/tog-pegasus/tree/Regression/bz326281-wrong-init-script-return-codes/runtest.sh


(In reply to comment #3)
> This bug is consequence of bz#824297. I suggest to close it as DUPLICATE.

yes, you can close as you wish.
Testing procedure in this bug is going to be performed in bug 824297
Comment 7 Vitezslav Crhonek 2012-05-29 07:43:00 EDT
OK, closing as a duplicate then. Thanks!

*** This bug has been marked as a duplicate of bug 824297 ***

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