Bug 823539

Summary: init script failure for unprivileges / nonroot user
Product: Red Hat Enterprise Linux 6 Reporter: Petr Sklenar <psklenar>
Component: tog-pegasusAssignee: Vitezslav Crhonek <vcrhonek>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-daemons
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-29 11:43:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Petr Sklenar 2012-05-21 13:37:17 UTC
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 Program Management 2012-05-25 03:45:54 UTC
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 14:45:32 UTC
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 10:41:41 UTC
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 10:44:24 UTC
(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 11:00:00 UTC
(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 11:43:00 UTC
OK, closing as a duplicate then. Thanks!

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