Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-13827

Shell variable should be escaped in start-scala-shell.sh

    XMLWordPrintableJSON

Details

    Description

      diff --git a/flink-scala-shell/start-script/start-scala-shell.sh b/flink-scala-shell/start-script/start-scala-shell.sh
      index b6da81af72..65b9045584 100644
      --- a/flink-scala-shell/start-script/start-scala-shell.sh
      +++ b/flink-scala-shell/start-script/start-scala-shell.sh
      @@ -97,9 +97,9 @@ log_setting="-Dlog.file="$LOG" -Dlog4j.configuration=file:"$FLINK_CONF_DIR"/$LOG
       
       if ${EXTERNAL_LIB_FOUND}
       then
      -    $JAVA_RUN -Dscala.color -cp "$FLINK_CLASSPATH" $log_setting org.apache.flink.api.scala.FlinkShell $@ --addclasspath "$EXT_CLASSPATH"
      +    $JAVA_RUN -Dscala.color -cp "$FLINK_CLASSPATH" "$log_setting" org.apache.flink.api.scala.FlinkShell $@ --addclasspath "$EXT_CLASSPATH"
       else
      -    $JAVA_RUN -Dscala.color -cp "$FLINK_CLASSPATH" $log_setting org.apache.flink.api.scala.FlinkShell $@
      +    $JAVA_RUN -Dscala.color -cp "$FLINK_CLASSPATH" "$log_setting" org.apache.flink.api.scala.FlinkShell $@
       fi
       
       #restore echo
      

      otherwise it is error prone when $log_setting contain arbitrary content.

      For example, if the parent dir contain whitespace, said flink-1.9.0 2, then bin/start-scala-shell.sh local will fail with

      Error: Could not find or load main class 2.log.flink-*-scala-shell-local-*.log

      Attachments

        Issue Links

          Activity

            People

              tison Zili Chen
              tison Zili Chen
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 40m
                  40m