Github user kanzhang commented on a diff in the pull request: https://github.com/apache/spark/pull/1845#discussion_r16330493 --- Diff: bin/utils.sh --- @@ -17,9 +16,53 @@ # limitations under the License. # +# * ---------------------------------------------------- * +# | Utility functions for launching Spark applications | +# * ---------------------------------------------------- * + +# Parse the value of a config from a java properties file according to the specifications in +# http://docs.oracle.com/javase/7/docs/api/java/util/Properties.html#load(java.io.Reader), +# with the exception of the support for multi-line arguments. This accepts the name of the +# config as an argument, and expects the path of the property file to be found in +# PROPERTIES_FILE. The value is returned through JAVA_PROPERTY_VALUE. +function parse_java_property() { + JAVA_PROPERTY_VALUE=$(\ + grep "^[[:space:]]*$1" "$PROPERTIES_FILE" | \ + head -n 1 | \ + sed "s/^[[:space:]]*$1//g" | \ + sed "s/^[[:space:]]*[:=]\{0,1\}//g" | \ + sed "s/^[[:space:]]*//g" | \ + sed "s/[[:space:]]*$//g" + ) + export JAVA_PROPERTY_VALUE +} + +# Properly split java options, dealing with whitespace, double quotes and backslashes. +# This accepts a string and returns the resulting list through SPLIT_JAVA_OPTS. +# For security reasons, this is isolated in its own function. +function split_java_options() { + eval set -- "$1" --- End diff -- It's fair to say "I don't think this allows people to do anything they couldn't already do", assuming the input (local conf file) is considered trusted. Obviously, it shouldn't be called with untrusted inputs without validation.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org