Bug 741064

Summary: rhq-agent-wrapper.sh doesn't works when referenced by symlink on RHEL 4
Product: [Other] RHQ Project Reporter: Rafael Soares (Tuelho) <rsoares>
Component: Launch ScriptsAssignee: Nobody <nobody>
Status: NEW --- QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 4.1CC: hrupp
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rafael Soares (Tuelho) 2011-09-24 19:47:52 UTC
Description of problem:
rhq-agent-wrapper.sh doesn't works when referenced by a symlink on RHEL 4.x OS.

Version-Release number of selected component (if applicable):
tested on versions 3.x and 4.x

How reproducible:
Create a symlink in /etc/init.d/ pointing to RHQ_AGENT_HOME/bin/rhq-agent-wrapper.sh on a RHEL 4.x OS box.

Steps to Reproduce:
1. Try to start the agent using the symlink (eg. /etc/init.d/rhq-agent)
2. 
3.
  
Actual results:
The agent wont start correctly.


Expected results:
Agent statup ok.

Additional info:

I think the problem occurs due the use of '-e' parameter of readlink command in this part of wrapper script:

"
...
# -------------------------------
# Get the location of this script.
# Make sure we take into account the possibility $0
# is a symlink to the real agent installation script.
# Only certain platforms support the -e option of readlink

if [ "x${_LINUX}${_SOLARIS}${_CYGWIN}" != "x" ]; then
   _READLINK_ARG="-e"
fi

_DOLLARZERO=`readlink $_READLINK_ARG "$0" 2>/dev/null|| echo "$0"`
RHQ_AGENT_WRAPPER_BIN_DIR_PATH=`dirname "$_DOLLARZERO"`
...
"

As the comment says (# Only certain platforms support the -e option of readlink...), RHEL 4 is one of the OS doesn't supports it.

IMO the '-e' flag is not necessary, at least, when running on Linux OS.

Comment 1 Charles Crouch 2011-09-28 01:23:31 UTC
Here is the bug which added the -e flag
https://bugzilla.redhat.com/show_bug.cgi?id=535784