Bug 54023

Summary: Unable to start JMeter from a root directory and if the full path of JMeter installation contains one or more spaces
Product: JMeter - Now in Github Reporter: Daniel Aquino <mr.danielaquino>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: trivial CC: mr.danielaquino, p.mouawad
Priority: P4    
Version: 2.8   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X 10.4   

Description Daniel Aquino 2012-10-17 20:27:12 UTC

    
Comment 1 Philippe Mouawad 2012-10-27 12:45:24 UTC
Are you getting a bug ?
On which platform ? and with what kind of folder names ?

Thank you
Comment 2 Daniel Aquino 2012-11-01 15:29:46 UTC
That's proper shell practice to quote all paths in case they contain spaces.

That particular issue above causes the script to fail if any directory it's under contains a space:

$ p='/a/b c/d/e'

$ dirname $p
dirname: extra operand `c/d/e'
Try `dirname --help' for more information.

$ dirname "$p"
/a/b c/d
Comment 3 Philippe Mouawad 2012-11-17 16:08:51 UTC
On which OS does it fail ?

I tested on Mac OS X it works.
I don't have Linux to test.
Comment 4 Daniel Aquino 2012-11-17 18:28:53 UTC
Did you try the example code I posted ?  Because then you would see..

The line should look like this:

"$(dirname -- "$0")/ApacheJMeter.jar"
Comment 5 Milamber 2012-11-17 20:09:24 UTC
Description of issue:
bin/jmeter should quote paths properly, like this: "`dirname "$0"`/ApacheJMeter.jar"
Comment 6 Milamber 2012-11-17 20:14:21 UTC
Thanks for report. Fixed.

The issue occur when you try to launch JMeter since another directory (not bin dir) and if jmeter script path have one or more spaces.

Example 
$ /tmp/directory\ with\ spaces/apache-jmeter-2.8/bin/jmeter
dirname: extra operand `with'
Try `dirname --help' for more information.
Unable to access jarfile /ApacheJMeter.jar


Fixed by adding a double couple of quotes :

java $ARGS $JVM_ARGS -jar "`dirname "$0"`/ApacheJMeter.jar" "$@"

===
URL: http://svn.apache.org/viewvc?rev=1410775&view=rev
Log:
Unable to start JMeter from a root directory and if the full path of JMeter installation contains one or more spaces
Bugzilla Id: 54023

Modified:
    jmeter/trunk/bin/jmeter
    jmeter/trunk/xdocs/changes.xml
Comment 7 The ASF infrastructure team 2022-09-24 20:37:51 UTC
This issue has been migrated to GitHub: https://github.com/apache/jmeter/issues/2957