https://bugzilla.redhat.com/show_bug.cgi?id=1132224
Bug ID: 1132224
Summary: java-functions cannot handle spaces in flags/options
Product: Fedora
Version: 21
Component: javapackages-tools
Assignee: mizdebsk(a)redhat.com
Reporter: ctubbsii-fedora(a)apache.org
QA Contact: extras-qa(a)fedoraproject.org
CC: java-sig-commits(a)lists.fedoraproject.org,
mizdebsk(a)redhat.com, msimacek(a)redhat.com,
msrb(a)redhat.com
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.
--
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug
https://bugzilla.redhat.com/token.cgi?t=qQdKr31DKb&a=cc_unsubscribe