Bug 536445 - (RHQ-793) allow discovery / management of apache instances containing whitespace in the executable path
allow discovery / management of apache instances containing whitespace in the...
Product: RHQ Project
Classification: Other
Component: Plugins (Show other bugs)
All All
low Severity medium (vote)
: ---
: ---
Assigned To: Heiko W. Rupp
Corey Welton
: Improvement
Depends On:
  Show dependency treegraph
Reported: 2008-09-06 20:03 EDT by Joseph Marques
Modified: 2008-12-11 00:23 EST (History)
0 users

See Also:
Fixed In Version: 1.2
Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Joseph Marques 2008-09-06 20:03:00 EDT
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 08:53:33 EST
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 14:56:24 EST
See also https://jira.jboss.org/jira/browse/JBNADM-3459
Comment 3 John Mazzitelli 2008-11-21 15:03:12 EST
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 15:34:02 EST
Check for spaces has been eliminated.
Comment 5 Corey Welton 2008-12-11 00:23:14 EST
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 16:17:01 EST
This bug was previously known as http://jira.rhq-project.org/browse/RHQ-793

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