Bug 536445 (RHQ-793)

Summary: allow discovery / management of apache instances containing whitespace in the executable path
Product: [Other] RHQ Project Reporter: Joseph Marques <jmarques>
Component: PluginsAssignee: Heiko W. Rupp <hrupp>
Status: CLOSED NEXTRELEASE QA Contact: Corey Welton <cwelton>
Severity: medium Docs Contact:
Priority: low    
Version: 1.1preKeywords: Improvement
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
URL: http://jira.rhq-project.org/browse/RHQ-793
Whiteboard:
Fixed In Version: 1.2 Doc Type: Enhancement
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 Joseph Marques 2008-09-07 00:03:00 UTC
2008-09-06 19:06:12,808 ERROR [InventoryManager.discovery-1] (rhq.plugins.apache.util.ApacheBinaryInfo)- Error running binary 'C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe': executable cannot contain whitespace. Executable: [C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe]
java.lang.IllegalArgumentException: executable cannot contain whitespace. Executable: [C:\Program Files\Apache Software Foundation\Apache2.2\bin\httpd.exe]
	at org.rhq.core.system.ProcessExecution.<init>(ProcessExecution.java:56)
	at org.rhq.plugins.apache.util.ApacheBinaryInfo.getVersionCommandInfo(ApacheBinaryInfo.java:134)
	at org.rhq.plugins.apache.util.ApacheBinaryInfo.getApacheBinaryInfo(ApacheBinaryInfo.java:192)
	at org.rhq.plugins.apache.util.ApacheBinaryInfo.getInfo(ApacheBinaryInfo.java:75)
	at org.rhq.plugins.apache.ApacheServerDiscoveryComponent.discoverResources(ApacheServerDiscoveryComponent.java:78)
	at org.rhq.core.pc.inventory.AutoDiscoveryExecutor.pluginDiscovery(AutoDiscoveryExecutor.java:193)
	at org.rhq.core.pc.inventory.AutoDiscoveryExecutor.call(AutoDiscoveryExecutor.java:99)
	at org.rhq.core.pc.inventory.AutoDiscoveryExecutor.run(AutoDiscoveryExecutor.java:88)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:181)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:205)
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
	at java.lang.Thread.run(Thread.java:619)

Comment 1 Heiko W. Rupp 2008-11-21 13:53:33 UTC
Underlying issue is this check in the constructor of ProcessExecution:

        StringTokenizer splitter = new StringTokenizer(executable);
        if (splitter.countTokens() > 1) {
            throw new IllegalArgumentException("executable cannot contain whitespace. Executable: [" + executable + "]");
        }


It filters all path with whitespaces -- even if they had been escaped as in "/tmp/t\ est/echo".


Note that doing the following

ProcessExecution pe = new ProcessExecution("dummy");
pe.setExecutable("/tmp/t\ est/echo");

will not check for whitespaces and will happily execute the echo command

Comment 2 Heiko W. Rupp 2008-11-21 19:56:24 UTC
See also https://jira.jboss.org/jira/browse/JBNADM-3459

Comment 3 John Mazzitelli 2008-11-21 20:03:12 UTC
I have to believe we can take that tokenizer check out. I can't see how that could ever be a good thing - since Windows loves spaces in full paths to executables.  Whatever this was meant to fix, needs to be fixed in another way - this check has to be removed.

Comment 4 Heiko W. Rupp 2008-11-21 20:34:02 UTC
Check for spaces has been eliminated.

Comment 5 Corey Welton 2008-12-11 05:23:14 UTC
QA Verified, I have set the executable location to "/tmp/foo bar/httpd" (a symlink to the original location) and submitted.  The system appears to have no problems finding the httpd server.

Comment 6 Red Hat Bugzilla 2009-11-10 21:17:01 UTC
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-793