Description of problem: set_flags and set_options in /usr/share/java-utils/java-functions cannot handle options with spaces. Version-Release number of selected component (if applicable): javapackages-tools-4.1.0-2.fc21.noarch (probably affects other versions as well) How reproducible: 100% Steps to Reproduce: 1. Create an application script (using %jpackage_script maybe) 2. Observe the generated script Actual results: There's a few issues. First, the generated output for %jpackage_script assigns the variables BASE_FLAGS and BASE_OPTIONS as strings instead of arrays. (This probably also affects BASE_JARS, but the nature of that limits the likelihood that it will contain individual elements with spaces.) Second, the $BASE_FLAGS and $BASE_OPTIONS are passed as arguments to set_flags and set_options functions, respectively, without passing as arrays. Third, the set_flags and set_options functions themselves flatten their arguments to a string for use later when passing to the $JAVA_CMD. Fourth, internal values of $OPTIONS and $FLAGS are passed to $JAVA_CMD as a string. This is a big limitation, because some arguments may have spaces, such as "-XX:OnOutOfMemoryError=kill -9 %s", which does not seem to be capable of properly quoting/escaping to pass all the way through to the exec line. Expected results: The arguments should be carried as arrays throughout, so they can be properly passed to the $JAVA_CMD. Example: BASE_FLAGS=("%5") # (assuming %5 is the rpm argument) set_flags "${BASE_FLAGS[@]}" set_flags() { FLAGS=("$@") } exec $JAVA_CMD "${FLAGS[@]}" ... Additional info: When used with %jpackage_script, one cannot put spaces into arguments in the first place... unless one defines a macro. This is a limitation of rpm, but the macro is a reasonable workaround. I could not find an upstream issue tracker or bug report.
Correction: that -XX:OnOutOfMemoryError should have %p, not %s, but the use case holds.
Reproduced: $ . /usr/share/java-utils/java-functions $ set_flags 'foo bar' baz $ echo $FLAGS foo bar baz (In reply to Christopher Tubbs from comment #0) > I could not find an upstream issue tracker or bug report. Javapackages-tools is developed by Fedora people and this Bugzilla is the best place for bug reports and RFEs. (Some doc is available in /usr/share/doc/javapackages-tools-doc/index.html, from javapackages-tools-doc).
This should be fixed upstream in a3df333. https://github.com/mizdebsk/javapackages/commit/a3df333 I didn't test this much yet. For testing you can use latest javapackages RPMs, which are available from Jenkins: http://jenkins.cloud.fedoraproject.org/job/javapackages-tools/ws/RPM/latest/
Verified using upstream snapshot 4.3.0-0.152.git3a1f75c $ . /usr/share/java-utils/java-functions $ set_flags 'foo bar' baz $ echo $FLAGS 'foo bar' 'baz'
Fixed in javapackages-tools-4.3.0-1
I believe that this bug is fixed in javapackages-tools-4.3.0-1, which is available in Fedora Rawhide, so I am closing this bug now. The build containing the fix can be found at Koji: http://koji.fedoraproject.org/koji/buildinfo?buildID=599231 This bug was fixed in the next release of Fedora, and is not planned to be fixed in the release it was filed against. If you want this bug to be fixed in Fedora 21, please say so in a comment. Otherwise you can update to the newer release of Fedora to get the fix.