From: Janos Gyerik Date: Thu, 15 Mar 2018 11:05:01 +0000 (+0100) Subject: Fix minor safety issues in built-in patches (#3155) X-Git-Tag: 7.5~1529 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=31436ae379c0680f6502a35ef590afa4ac819e47;p=sonarqube.git Fix minor safety issues in built-in patches (#3155) * Add shebang line for all patches * Properly double-quote variables used on the command line * Use different debug port for debug CE and Web * Add double-quotes around long -agentlib option too --- diff --git a/scripts/patches/README.md b/scripts/patches/README.md index 709c7bb81d5..25db7196408 100644 --- a/scripts/patches/README.md +++ b/scripts/patches/README.md @@ -34,8 +34,9 @@ Example scripts SQ_HOME=$1 - echo "enabling debug in conf/sonar.properties, listening on port 5005" - set_property sonar.web.javaAdditionalOpts -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 "$SQ_HOME/conf/sonar.properties" + port=5005 + echo "enabling debug in conf/sonar.properties, listening on port $port" + set_property sonar.web.javaAdditionalOpts "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port" "$SQ_HOME/conf/sonar.properties" ### Views diff --git a/scripts/patches/debug_ce.sh b/scripts/patches/debug_ce.sh index aafeadaf8c7..f0ea04eb9c3 100755 --- a/scripts/patches/debug_ce.sh +++ b/scripts/patches/debug_ce.sh @@ -1,8 +1,11 @@ +#!/usr/bin/env bash + set -euo pipefail source scripts/property_utils.sh SQ_HOME=$1 -echo "enabling debug on compute engine, listening on port 5005" -set_property sonar.ce.javaAdditionalOpts -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 $SQ_HOME/conf/sonar.properties +port=5006 +echo "enabling debug on compute engine, listening on port $port" +set_property sonar.ce.javaAdditionalOpts "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port" "$SQ_HOME/conf/sonar.properties" diff --git a/scripts/patches/debug_web.sh b/scripts/patches/debug_web.sh index 831a6dd5b17..ae06f2b9485 100755 --- a/scripts/patches/debug_web.sh +++ b/scripts/patches/debug_web.sh @@ -1,8 +1,11 @@ +#!/usr/bin/env bash + set -euo pipefail source scripts/property_utils.sh SQ_HOME=$1 -echo "enabling debug on web server, listening on port 5005" -set_property sonar.web.javaAdditionalOpts -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 $SQ_HOME/conf/sonar.properties +port=5005 +echo "enabling debug on web server, listening on port $port" +set_property sonar.web.javaAdditionalOpts "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port" "$SQ_HOME/conf/sonar.properties" diff --git a/scripts/patches/mysql.sh b/scripts/patches/mysql.sh index 59931e77b94..ce0f260d615 100755 --- a/scripts/patches/mysql.sh +++ b/scripts/patches/mysql.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + set -euo pipefail source scripts/property_utils.sh @@ -5,6 +7,6 @@ source scripts/property_utils.sh SQ_HOME=$1 echo "configuring mysql" -set_property sonar.jdbc.url "jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" $SQ_HOME/conf/sonar.properties -set_property sonar.jdbc.username sonarqube $SQ_HOME/conf/sonar.properties -set_property sonar.jdbc.password sonarqube $SQ_HOME/conf/sonar.properties +set_property sonar.jdbc.url "jdbc:mysql://localhost:3306/sonarqube?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance" "$SQ_HOME/conf/sonar.properties" +set_property sonar.jdbc.username sonarqube "$SQ_HOME/conf/sonar.properties" +set_property sonar.jdbc.password sonarqube "$SQ_HOME/conf/sonar.properties" diff --git a/scripts/patches/postgres.sh b/scripts/patches/postgres.sh index 0f3b10559ac..5465c458468 100755 --- a/scripts/patches/postgres.sh +++ b/scripts/patches/postgres.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + set -euo pipefail source scripts/property_utils.sh @@ -5,6 +7,6 @@ source scripts/property_utils.sh SQ_HOME=$1 echo "configuring postgres" -set_property sonar.jdbc.url jdbc:postgresql://localhost:5432/sonarqube $SQ_HOME/conf/sonar.properties -set_property sonar.jdbc.username sonarqube $SQ_HOME/conf/sonar.properties -set_property sonar.jdbc.password sonarqube $SQ_HOME/conf/sonar.properties +set_property sonar.jdbc.url jdbc:postgresql://localhost:5432/sonarqube "$SQ_HOME/conf/sonar.properties" +set_property sonar.jdbc.username sonarqube "$SQ_HOME/conf/sonar.properties" +set_property sonar.jdbc.password sonarqube "$SQ_HOME/conf/sonar.properties"