Bug 1358422

Summary: LD_LIBRARY_PATH entries exported in unix session are overriden in apachectl script
Product: [JBoss] JBoss Enterprise Web Server 2 Reporter: fgoldefu
Component: httpdAssignee: Coty Sutherland <csutherl>
Status: CLOSED WONTFIX QA Contact: Jan Stefl <jstefl>
Severity: urgent Docs Contact:
Priority: urgent    
Version: 2.1.1CC: jclere, jdoyle, pslavice, rsvoboda
Target Milestone: CR02   
Target Release: 2.1.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
When LD_LIBRARY_PATH content was overwritten by apachectl, you could not set it before starting apachectl. This is fixed. The part needed by apachectl is added before the environment variable value.
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-06-13 12:22:42 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:
Bug Depends On:    
Bug Blocks: 1363639    

Description fgoldefu 2016-07-20 16:01:11 UTC
Description of problem:
LD_LIBRARY_PATH entries exported in unix session are overridden in apachectl script.

Version-Release number of selected component (if applicable):
EWS 2.1.1

How reproducible:
Every time.

Steps to Reproduce:
1. Set LD_LIBRARY_PATH in a shell
2. Use apachectl to start/stop/etc
3. Observe that your LD_LIBRARY_PATH was overridden by the apachectl version.

Actual results:
apachectl overwrites LD_LIBRARY_PATH

Expected results:
apachectl shouldn't overwrite LD_LIBRARY_PATH

Comment 2 Bogdan Sikora 2016-08-01 06:32:50 UTC
Change to "export LD_LIBRARY_PATH="$currentDir/lib:$LD_LIBRARY_PATH"" in postinstall is not correct as it will result to "export LD_LIBRARY_PATH="/opt/jboss-ews-2.1/httpd/lib:"" you need to escape it in postinstall

Comment 5 Bogdan Sikora 2016-08-08 06:35:54 UTC
it makes sense ;) It's part of postinstall script that changes apachectl, if $ is not escaped, LD_LIBRARY_PATH will be resolved to it's actual value when postinstall is run. One want to set LD_LIBRARY_PATH when starting apache httpd server, and not postinstall, i suppose...

Comment 6 Jean-frederic Clere 2016-08-08 14:05:01 UTC
So probably the $currentDir needs to be escaped too no?

Comment 7 Coty Sutherland 2016-08-08 14:22:30 UTC
(In reply to Jean-frederic Clere from comment #6)
> So probably the $currentDir needs to be escaped too no?

No, if we do that the apachectl will always export ":" because it can't evaluate the $currentDir variable at runtime. The postinstall script is a script executed to create another script (for this portion); it updates the LD_LIBRARY_PATH location in apachectl. If we don't escape the variable, you get the following in apachectl after running postinstall:

$ grep LD_LIBRARY_PATH sbin/apachectl 
export LD_LIBRARY_PATH="~/jboss-ews-2.1/httpd/lib:"

Obviously, that's wrong. What we really want is:

$ grep LD_LIBRARY_PATH sbin/apachectl 
export LD_LIBRARY_PATH="~/jboss-ews-2.1/httpd/lib:$LD_LIBRARY_PATH"

so that the variable gets evaluated every time the user executes apachectl, not when the postinstall script is executed.

Comment 8 JBoss JIRA Server 2016-08-25 11:05:01 UTC
Michal Karm Babacek <mbabacek> updated the status of jira JBCS-65 to Resolved

Comment 9 JBoss JIRA Server 2016-09-21 11:37:03 UTC
Bogdan Sikora <bsikora> updated the status of jira JBCS-65 to Reopened

Comment 10 JBoss JIRA Server 2016-09-21 16:08:16 UTC
Coty Sutherland <csutherl> updated the status of jira JBCS-65 to Resolved