github-actions[bot] commented on PR #30054: URL: https://github.com/apache/doris/pull/30054#issuecomment-1895132584
#### `sh-checker report` To get the full details, please check in the [job]("https://github.com/apache/doris/actions/runs/7552076471") output. <details> <summary>shellcheck errors</summary> ``` 'shellcheck ' returned error 1 finding the following syntactical issues: ---------- In build.sh line 557: if [ ${BUILD_CLOUD} -eq 1 ] ; then ^----------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^------------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ "${BUILD_CLOUD}" -eq 1 ]] ; then In build.sh line 558: if [ -e ${DORIS_HOME}/gensrc/build/gen_cpp/cloud_version.h ]; then ^-- SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if [[ -e "${DORIS_HOME}"/gensrc/build/gen_cpp/cloud_version.h ]]; then In build.sh line 559: rm -f ${DORIS_HOME}/gensrc/build/gen_cpp/cloud_version.h ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: rm -f "${DORIS_HOME}"/gensrc/build/gen_cpp/cloud_version.h In build.sh line 564: if [ ${CLEAN} -eq 1 ]; then ^----------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ "${CLEAN}" -eq 1 ]]; then In build.sh line 565: rm -rf ${CMAKE_BUILD_DIR} ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: rm -rf "${CMAKE_BUILD_DIR}" In build.sh line 568: MAKE_PROGRAM="$(which "${BUILD_SYSTEM}")" ^---^ SC2230 (info): 'which' is non-standard. Use builtin 'command -v' instead. In build.sh line 571: mkdir -p ${CMAKE_BUILD_DIR} ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mkdir -p "${CMAKE_BUILD_DIR}" In build.sh line 572: cd ${CMAKE_BUILD_DIR} ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: cd "${CMAKE_BUILD_DIR}" In build.sh line 576: -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}" \ In build.sh line 578: ${CMAKE_USE_CCACHE} \ ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${CMAKE_USE_CCACHE}" \ In build.sh line 579: -DUSE_LIBCPP=${USE_LIBCPP} \ ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DUSE_LIBCPP="${USE_LIBCPP}" \ In build.sh line 580: -DSTRIP_DEBUG_INFO=${STRIP_DEBUG_INFO} \ ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DSTRIP_DEBUG_INFO="${STRIP_DEBUG_INFO}" \ In build.sh line 581: -DUSE_DWARF=${USE_DWARF} \ ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DUSE_DWARF="${USE_DWARF}" \ In build.sh line 582: -DUSE_JEMALLOC=${USE_JEMALLOC} \ ^-------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DUSE_JEMALLOC="${USE_JEMALLOC}" \ In build.sh line 584: -DBUILD_CHECK_META=${BUILD_CHECK_META:-OFF} ${DORIS_HOME}/cloud/ ^----------------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DBUILD_CHECK_META="${BUILD_CHECK_META:-OFF}" "${DORIS_HOME}"/cloud/ In build.sh line 585: ${BUILD_SYSTEM} -j ${PARALLEL} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ${BUILD_SYSTEM} -j "${PARALLEL}" In build.sh line 587: cd ${DORIS_HOME} ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: cd "${DORIS_HOME}" In cloud/script/run_all_tests.sh line 19: echo "input params: $@" ^-- SC2145 (error): Argument mixes string and array. Use * or separate argument. In cloud/script/run_all_tests.sh line 24: OPTS=$(getopt -n $0 -o a:b:c: -l test:,fdb:,filter:,coverage -- "$@") ^-- SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: OPTS=$(getopt -n "$0" -o a:b:c: -l test:,fdb:,filter:,coverage -- "$@") In cloud/script/run_all_tests.sh line 25: if [ "$?" != "0" ]; then ^-------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^--^ SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. Did you mean: if [[ "$?" != "0" ]]; then In cloud/script/run_all_tests.sh line 30: eval set -- "$OPTS" ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: eval set -- "${OPTS}" In cloud/script/run_all_tests.sh line 36: if [ $# != 1 ] ; then ^---------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ $# != 1 ]] ; then In cloud/script/run_all_tests.sh line 66: local profraw=$(ls ./report/*.profraw) ^-----^ SC2155 (warning): Declare and assign separately to avoid masking return values. In cloud/script/run_all_tests.sh line 68: for object in ${binary_objects[@]}; do ^------------------^ SC2068 (error): Double quote array expansions to avoid re-splitting elements. In cloud/script/run_all_tests.sh line 71: llvm-profdata merge -o ${profdata} ${profraw} ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: llvm-profdata merge -o "${profdata}" "${profraw}" In cloud/script/run_all_tests.sh line 74: -instr-profile=${profdata} \ ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: -instr-profile="${profdata}" \ In cloud/script/run_all_tests.sh line 75: ${binary_objects_options[*]} ^--------------------------^ SC2048 (warning): Use "${array[@]}" (with quotes) to prevent whitespace problems. ^--------------------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${binary_objects_options[*]}" In cloud/script/run_all_tests.sh line 80: for i in `ls *_test`; do ^---------^ SC2045 (error): Iterating over ls output is fragile. Use globs. ^---------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-- SC2035 (info): Use ./*glob* or -- *glob* so names with dashes won't become options. Did you mean: for i in $(ls *_test); do In cloud/script/run_all_tests.sh line 81: if [ "${test}" != "" ]; then ^-----------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ "${test}" != "" ]]; then In cloud/script/run_all_tests.sh line 82: if [ "${test}" != "${i}" ]; then ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ "${test}" != "${i}" ]]; then In cloud/script/run_all_tests.sh line 86: if [ -x ${i} ]; then ^---------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if [[ -x "${i}" ]]; then In cloud/script/run_all_tests.sh line 88: fdb=$(ldd ${i} | grep libfdb_c | grep found) ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: fdb=$(ldd "${i}" | grep libfdb_c | grep found) In cloud/script/run_all_tests.sh line 89: if [ "${fdb}" != "" ]; then ^----------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ "${fdb}" != "" ]]; then In cloud/script/run_all_tests.sh line 90: patchelf --set-rpath `pwd` ${i} ^---^ SC2046 (warning): Quote this to prevent word splitting. ^---^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: patchelf --set-rpath $(pwd) "${i}" In cloud/script/run_all_tests.sh line 93: if [ "${filter}" == "" ]; then ^-------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ "${filter}" == "" ]]; then In cloud/script/run_all_tests.sh line 94: LLVM_PROFILE_FILE="./report/${i}.profraw" ./${i} --gtest_print_time=true --gtest_output=xml:${i}.xml ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: LLVM_PROFILE_FILE="./report/${i}.profraw" ./"${i}" --gtest_print_time=true --gtest_output=xml:"${i}".xml In cloud/script/run_all_tests.sh line 96: LLVM_PROFILE_FILE="./report/${i}.profraw" ./${i} --gtest_print_time=true --gtest_output=xml:${i}.xml --gtest_filter=${filter} ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: LLVM_PROFILE_FILE="./report/${i}.profraw" ./"${i}" --gtest_print_time=true --gtest_output=xml:"${i}".xml --gtest_filter="${filter}" In cloud/script/start.sh line 18: curdir="$(cd "$(dirname $(readlink -f ${BASH_SOURCE[0]}))" &>/dev/null && pwd)" ^-- SC2046 (warning): Quote this to prevent word splitting. ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: curdir="$(cd "$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" &>/dev/null && pwd)" In cloud/script/start.sh line 20: cd "${curdir}/.." ^---------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Did you mean: cd "${curdir}/.." || exit In cloud/script/start.sh line 24: cd ${doris_cloud_home} ^--------------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: cd "${doris_cloud_home}" || exit In cloud/script/start.sh line 28: exit -1 ^-- SC2242 (error): Can only exit with status 0-255. Other data should be written to stdout/stderr. In cloud/script/start.sh line 34: [ "$arg" = "--daemonized" ] && daemonized=1 && continue ^-------------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ "${arg}" = "--daemonized" ]] && daemonized=1 && continue In cloud/script/start.sh line 35: [ "$arg" = "-daemonized" ] && daemonized=1 && continue ^------------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ "${arg}" = "-daemonized" ]] && daemonized=1 && continue In cloud/script/start.sh line 36: [ "$arg" = "--daemon" ] && daemonized=1 && continue ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ "${arg}" = "--daemon" ]] && daemonized=1 && continue In cloud/script/start.sh line 37: set -- "$@" "$arg" ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: set -- "$@" "${arg}" In cloud/script/start.sh line 43: if [ -f ${doris_cloud_home}/bin/${process}.pid ]; then ^-- SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ -f "${doris_cloud_home}"/bin/"${process}".pid ]]; then In cloud/script/start.sh line 44: pid=$(cat ${doris_cloud_home}/bin/${process}.pid) ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: pid=$(cat "${doris_cloud_home}"/bin/"${process}".pid) In cloud/script/start.sh line 45: if [ "${pid}" != "" ]; then ^----------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ "${pid}" != "" ]]; then In cloud/script/start.sh line 46: ps axu | grep "$pid" 2>&1 | grep doris_cloud > /dev/null 2>&1 ^----^ SC2009 (info): Consider using pgrep instead of grepping ps output. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: ps axu | grep "${pid}" 2>&1 | grep doris_cloud > /dev/null 2>&1 In cloud/script/start.sh line 47: if [ $? -eq 0 ]; then ^----------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Did you mean: if [[ $? -eq 0 ]]; then In cloud/script/start.sh line 49: exit -1; ^-- SC2242 (error): Can only exit with status 0-255. Other data should be written to stdout/stderr. In cloud/script/start.sh line 53: rm -f ${doris_cloud_home}/bin/${process}.pid ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: rm -f "${doris_cloud_home}"/bin/"${process}".pid In cloud/script/start.sh line 58: ldd ${bin} | grep -Ei 'libfdb_c.*not found' &> /dev/null ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ldd "${bin}" | grep -Ei 'libfdb_c.*not found' &> /dev/null In cloud/script/start.sh line 59: if [ $? -eq 0 ]; then ^----------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^-- SC2181 (style): Check exit code directly with e.g. 'if mycmd;', not indirectly with $?. Did you mean: if [[ $? -eq 0 ]]; then In cloud/script/start.sh line 62: exit -1 ^-- SC2242 (error): Can only exit with status 0-255. Other data should be written to stdout/stderr. In cloud/script/start.sh line 64: patchelf --set-rpath ${lib_path} ${bin} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: patchelf --set-rpath "${lib_path}" "${bin}" In cloud/script/start.sh line 65: ldd ${bin} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ldd "${bin}" In cloud/script/start.sh line 70: mkdir -p ${doris_cloud_home}/log ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mkdir -p "${doris_cloud_home}"/log In cloud/script/start.sh line 71: echo "starts ${process} with args: $@" ^-- SC2145 (error): Argument mixes string and array. Use * or separate argument. In cloud/script/start.sh line 72: if [ ${daemonized} -eq 1 ]; then ^---------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^-----------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ "${daemonized}" -eq 1 ]]; then In cloud/script/start.sh line 73: date >> ${doris_cloud_home}/log/${process}.out ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: date >> "${doris_cloud_home}"/log/"${process}".out In cloud/script/start.sh line 74: nohup ${bin} "$@" >> ${doris_cloud_home}/log/${process}.out 2>&1 & ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: nohup "${bin}" "$@" >> "${doris_cloud_home}"/log/"${process}".out 2>&1 & In cloud/script/start.sh line 77: tail -n10 ${doris_cloud_home}/log/${process}.out | grep 'working directory' -B1 -A10 ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: tail -n10 "${doris_cloud_home}"/log/"${process}".out | grep 'working directory' -B1 -A10 In cloud/script/stop.sh line 18: curdir="$(cd "$(dirname $(readlink -f ${BASH_SOURCE[0]}))" &>/dev/null && pwd)" ^-- SC2046 (warning): Quote this to prevent word splitting. ^---------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: curdir="$(cd "$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" &>/dev/null && pwd)" In cloud/script/stop.sh line 20: cd "${curdir}/.." ^---------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails. Did you mean: cd "${curdir}/.." || exit In cloud/script/stop.sh line 24: cd ${doris_cloud_home} ^--------------------^ SC2164 (warning): Use 'cd ... || exit' or 'cd ... || return' in case cd fails. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: cd "${doris_cloud_home}" || exit In cloud/script/stop.sh line 28: if [ ! -f ${doris_cloud_home}/bin/${process}.pid ]; then ^-- SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ ! -f "${doris_cloud_home}"/bin/"${process}".pid ]]; then In cloud/script/stop.sh line 30: exit -1 ^-- SC2242 (error): Can only exit with status 0-255. Other data should be written to stdout/stderr. In cloud/script/stop.sh line 33: pid=`cat ${doris_cloud_home}/bin/${process}.pid` ^-- SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: pid=$(cat "${doris_cloud_home}"/bin/"${process}".pid) In cloud/script/stop.sh line 34: kill -2 ${pid} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: kill -2 "${pid}" In cloud/script/stop.sh line 35: rm -f ${doris_cloud_home}/bin/${process}.pid ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: rm -f "${doris_cloud_home}"/bin/"${process}".pid In gensrc/script/gen_build_version.sh line 211: if [ -f /etc/os-release ]; then ^--------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ -f /etc/os-release ]]; then In gensrc/script/gen_build_version.sh line 212: build_os_version=$(cat /etc/os-release | head -n2 | tr '\n' ' ') ^-------------^ SC2002 (style): Useless cat. Consider 'cmd < file | ..' or 'cmd file | ..' instead. In gensrc/script/gen_build_version.sh line 232: build_initiator="${user}@${hostname}" ^-----^ SC2154 (warning): user is referenced but not assigned. In run-cloud-ut.sh line 35: ROOT=`dirname "$0"` ^------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`. Did you mean: ROOT=$(dirname "$0") In run-cloud-ut.sh line 36: ROOT=`cd "$ROOT"; pwd` ^---------------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`. ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: ROOT=$(cd "${ROOT}"; pwd) In run-cloud-ut.sh line 67: OPTS=$(getopt -n $0 -o vhj:f: -l run,clean,filter:,fdb:,coverage -- "$@") ^-- SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: OPTS=$(getopt -n "$0" -o vhj:f: -l run,clean,filter:,fdb:,coverage -- "$@") In run-cloud-ut.sh line 68: if [ "$?" != "0" ]; then ^-------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^--^ SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. Did you mean: if [[ "$?" != "0" ]]; then In run-cloud-ut.sh line 74: eval set -- "$OPTS" ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: eval set -- "${OPTS}" In run-cloud-ut.sh line 76: PARALLEL=$[$(nproc)/5+1] ^-------------^ SC2007 (style): Use $((..)) instead of deprecated $[..] In run-cloud-ut.sh line 80: BUILD_BENCHMARK_TOOL=OFF ^------------------^ SC2034 (warning): BUILD_BENCHMARK_TOOL appears unused. Verify use (or export if used externally). In run-cloud-ut.sh line 85: if [ $# != 1 ] ; then ^---------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. Did you mean: if [[ $# != 1 ]] ; then In run-cloud-ut.sh line 95: *) usage ; exit 0 ;; ^-----^ SC2317 (info): Command appears to be unreachable. Check usage (or ignore if invoked indirectly). In run-cloud-ut.sh line 106: PARALLEL -- $PARALLEL ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: PARALLEL -- ${PARALLEL} In run-cloud-ut.sh line 107: CLEAN -- $CLEAN ^----^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: CLEAN -- ${CLEAN} In run-cloud-ut.sh line 116: . ${DORIS_HOME}/env.sh ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: . "${DORIS_HOME}"/env.sh In run-cloud-ut.sh line 119: if [ ${CLEAN} -eq 1 ]; then ^----------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ "${CLEAN}" -eq 1 ]]; then In run-cloud-ut.sh line 120: rm ${CMAKE_BUILD_DIR} -rf ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: rm "${CMAKE_BUILD_DIR}" -rf In run-cloud-ut.sh line 121: rm ${DORIS_HOME}/cloud/output/ -rf ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: rm "${DORIS_HOME}"/cloud/output/ -rf In run-cloud-ut.sh line 124: if [ ! -d ${CMAKE_BUILD_DIR} ]; then ^-------------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if [[ ! -d "${CMAKE_BUILD_DIR}" ]]; then In run-cloud-ut.sh line 125: mkdir -p ${CMAKE_BUILD_DIR} ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mkdir -p "${CMAKE_BUILD_DIR}" In run-cloud-ut.sh line 136: MAKE_PROGRAM="$(which "${BUILD_SYSTEM}")" ^---^ SC2230 (info): 'which' is non-standard. Use builtin 'command -v' instead. In run-cloud-ut.sh line 139: cd ${CMAKE_BUILD_DIR} ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: cd "${CMAKE_BUILD_DIR}" In run-cloud-ut.sh line 148: -DUSE_DWARF=${USE_DWARF} \ ^----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: -DUSE_DWARF="${USE_DWARF}" \ In run-cloud-ut.sh line 153: ${CMAKE_USE_CCACHE} ${DORIS_HOME}/cloud/ ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^-----------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: "${CMAKE_USE_CCACHE}" "${DORIS_HOME}"/cloud/ In run-cloud-ut.sh line 154: ${BUILD_SYSTEM} -j ${PARALLEL} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ${BUILD_SYSTEM} -j "${PARALLEL}" In run-cloud-ut.sh line 157: mkdir -p ${CMAKE_BUILD_DIR}/test/log ^----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mkdir -p "${CMAKE_BUILD_DIR}"/test/log In run-cloud-ut.sh line 159: if [ ${RUN} -ne 1 ]; then ^--------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^----^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: if [[ "${RUN}" -ne 1 ]]; then For more information: https://www.shellcheck.net/wiki/SC2045 -- Iterating over ls output is fragi... https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ... https://www.shellcheck.net/wiki/SC2145 -- Argument mixes string and array. ... ---------- You can address the above issues in one of three ways: 1. Manually correct the issue in the offending shell script; 2. Disable specific issues by adding the comment: # shellcheck disable=NNNN above the line that contains the issue, where NNNN is the error code; 3. Add '-e NNNN' to the SHELLCHECK_OPTS setting in your .yml action file. ``` </details> <details> <summary>shfmt errors</summary> ``` 'shfmt ' returned error 1 finding the following formatting issues: ---------- --- build.sh.orig +++ build.sh @@ -554,7 +554,7 @@ fi # Clean and build cloud -if [ ${BUILD_CLOUD} -eq 1 ] ; then +if [ ${BUILD_CLOUD} -eq 1 ]; then if [ -e ${DORIS_HOME}/gensrc/build/gen_cpp/cloud_version.h ]; then rm -f ${DORIS_HOME}/gensrc/build/gen_cpp/cloud_version.h fi @@ -570,25 +570,24 @@ echo "-- Extra cxx flags: ${EXTRA_CXX_FLAGS:-}" mkdir -p ${CMAKE_BUILD_DIR} cd ${CMAKE_BUILD_DIR} - ${CMAKE_CMD} -G "${GENERATOR}" \ - -DCMAKE_MAKE_PROGRAM="${MAKE_PROGRAM}" \ - -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ - -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ - -DMAKE_TEST=OFF \ - ${CMAKE_USE_CCACHE} \ - -DUSE_LIBCPP=${USE_LIBCPP} \ - -DSTRIP_DEBUG_INFO=${STRIP_DEBUG_INFO} \ - -DUSE_DWARF=${USE_DWARF} \ - -DUSE_JEMALLOC=${USE_JEMALLOC} \ - -DEXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS}" \ - -DBUILD_CHECK_META=${BUILD_CHECK_META:-OFF} ${DORIS_HOME}/cloud/ + ${CMAKE_CMD} -G "${GENERATOR}" \ + -DCMAKE_MAKE_PROGRAM="${MAKE_PROGRAM}" \ + -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \ + -DMAKE_TEST=OFF \ + ${CMAKE_USE_CCACHE} \ + -DUSE_LIBCPP=${USE_LIBCPP} \ + -DSTRIP_DEBUG_INFO=${STRIP_DEBUG_INFO} \ + -DUSE_DWARF=${USE_DWARF} \ + -DUSE_JEMALLOC=${USE_JEMALLOC} \ + -DEXTRA_CXX_FLAGS="${EXTRA_CXX_FLAGS}" \ + -DBUILD_CHECK_META=${BUILD_CHECK_META:-OFF} ${DORIS_HOME}/cloud/ ${BUILD_SYSTEM} -j ${PARALLEL} ${BUILD_SYSTEM} install cd ${DORIS_HOME} echo "Build cloud done" fi - if [[ "${BUILD_DOCS}" = "ON" ]]; then # Build docs, should be built before Frontend echo "Build docs" --- cloud/script/run_all_tests.sh.orig +++ cloud/script/run_all_tests.sh @@ -19,12 +19,12 @@ echo "input params: $@" function usage() { - echo "$0 [--fdb <fdb_conf>] [--test <test_binary>] [--filter <gtest_filter>]" + echo "$0 [--fdb <fdb_conf>] [--test <test_binary>] [--filter <gtest_filter>]" } -OPTS=$(getopt -n $0 -o a:b:c: -l test:,fdb:,filter:,coverage -- "$@") +OPTS=$(getopt -n $0 -o a:b:c: -l test:,fdb:,filter:,coverage -- "$@") if [ "$?" != "0" ]; then - usage - exit 1 + usage + exit 1 fi set -eo pipefail eval set -- "$OPTS" @@ -33,17 +33,35 @@ fdb_conf="" filter="" ENABLE_CLANG_COVERAGE="OFF" -if [ $# != 1 ] ; then - while true; do - case "$1" in - --coverage) ENABLE_CLANG_COVERAGE="ON"; shift 1;; - --test) test="$2"; shift 2;; - --fdb) fdb_conf="$2"; shift 2;; - --filter) filter="$2"; shift 2;; - --) shift ; break ;; - *) usage ; exit 1 ;; - esac - done +if [ $# != 1 ]; then + while true; do + case "$1" in + --coverage) + ENABLE_CLANG_COVERAGE="ON" + shift 1 + ;; + --test) + test="$2" + shift 2 + ;; + --fdb) + fdb_conf="$2" + shift 2 + ;; + --filter) + filter="$2" + shift 2 + ;; + --) + shift + break + ;; + *) + usage + exit 1 + ;; + esac + done fi set +eo pipefail @@ -53,55 +71,54 @@ # unset ASAN_OPTIONS if [[ "${fdb_conf}" != "" ]]; then - echo "update fdb_cluster.conf with \"${fdb_conf}\"" - echo "${fdb_conf}" > fdb.cluster + echo "update fdb_cluster.conf with \"${fdb_conf}\"" + echo "${fdb_conf}" >fdb.cluster fi # report converage for unittest # input param is unittest binary file list -function report_coverage() -{ - local binary_objects=$1 - local profdata="./report/doris_cloud.profdata" - local profraw=$(ls ./report/*.profraw) - local binary_objects_options=() - for object in ${binary_objects[@]}; do - binary_objects_options[${#binary_objects_options[*]}]="-object ${object}" - done - llvm-profdata merge -o ${profdata} ${profraw} - llvm-cov show -output-dir=report -format=html \ - -ignore-filename-regex='(.*gensrc/.*)|(.*_test\.cpp$)' \ - -instr-profile=${profdata} \ - ${binary_objects_options[*]} +function report_coverage() { + local binary_objects=$1 + local profdata="./report/doris_cloud.profdata" + local profraw=$(ls ./report/*.profraw) + local binary_objects_options=() + for object in ${binary_objects[@]}; do + binary_objects_options[${#binary_objects_options[*]}]="-object ${object}" + done + llvm-profdata merge -o ${profdata} ${profraw} + llvm-cov show -output-dir=report -format=html \ + -ignore-filename-regex='(.*gensrc/.*)|(.*_test\.cpp$)' \ + -instr-profile=${profdata} \ + ${binary_objects_options[*]} } export LSAN_OPTIONS=suppressions=./lsan_suppression.conf unittest_files=() -for i in `ls *_test`; do - if [ "${test}" != "" ]; then - if [ "${test}" != "${i}" ]; then - continue; +for i in $(ls *_test); do + if [ "${test}" != "" ]; then + if [ "${test}" != "${i}" ]; then + continue + fi fi - fi - if [ -x ${i} ]; then - echo "========== ${i} ==========" - fdb=$(ldd ${i} | grep libfdb_c | grep found) - if [ "${fdb}" != "" ]; then - patchelf --set-rpath `pwd` ${i} - fi + if [ -x ${i} ]; then + echo "========== ${i} ==========" + fdb=$(ldd ${i} | grep libfdb_c | grep found) + if [ "${fdb}" != "" ]; then + patchelf --set-rpath $(pwd) ${i} + fi - if [ "${filter}" == "" ]; then - LLVM_PROFILE_FILE="./report/${i}.profraw" ./${i} --gtest_print_time=true --gtest_output=xml:${i}.xml - else - LLVM_PROFILE_FILE="./report/${i}.profraw" ./${i} --gtest_print_time=true --gtest_output=xml:${i}.xml --gtest_filter=${filter} + if [ "${filter}" == "" ]; then + LLVM_PROFILE_FILE="./report/${i}.profraw" ./${i} --gtest_print_time=true --gtest_output=xml:${i}.xml + else + LLVM_PROFILE_FILE="./report/${i}.profraw" ./${i} --gtest_print_time=true --gtest_output=xml:${i}.xml --gtest_filter=${filter} + fi + unittest_files[${#unittest_files[*]}]="${i}" + echo "--------------------------" fi - unittest_files[${#unittest_files[*]}]="${i}" - echo "--------------------------" - fi done -if [[ "_${ENABLE_CLANG_COVERAGE}" == "_ON" ]];then - report_coverage "${unittest_files[*]}" +if [[ "_${ENABLE_CLANG_COVERAGE}" == "_ON" ]]; then + report_coverage "${unittest_files[*]}" fi # vim: et ts=2 sw=2: --- cloud/script/start.sh.orig +++ cloud/script/start.sh @@ -17,52 +17,52 @@ # under the License. curdir="$(cd "$(dirname $(readlink -f ${BASH_SOURCE[0]}))" &>/dev/null && pwd)" doris_cloud_home="$( - cd "${curdir}/.." - pwd + cd "${curdir}/.." + pwd )" cd ${doris_cloud_home} if [[ ! -d bin || ! -d conf || ! -d lib ]]; then - echo "$0 must be invoked at the directory which contains bin, conf and lib" - exit -1 + echo "$0 must be invoked at the directory which contains bin, conf and lib" + exit -1 fi daemonized=0 -for arg do - shift - [ "$arg" = "--daemonized" ] && daemonized=1 && continue - [ "$arg" = "-daemonized" ] && daemonized=1 && continue - [ "$arg" = "--daemon" ] && daemonized=1 && continue - set -- "$@" "$arg" +for arg; do + shift + [ "$arg" = "--daemonized" ] && daemonized=1 && continue + [ "$arg" = "-daemonized" ] && daemonized=1 && continue + [ "$arg" = "--daemon" ] && daemonized=1 && continue + set -- "$@" "$arg" done # echo "$@" "daemonized=${daemonized}"} process=doris_cloud if [ -f ${doris_cloud_home}/bin/${process}.pid ]; then - pid=$(cat ${doris_cloud_home}/bin/${process}.pid) - if [ "${pid}" != "" ]; then - ps axu | grep "$pid" 2>&1 | grep doris_cloud > /dev/null 2>&1 - if [ $? -eq 0 ]; then - echo "pid file existed, ${process} have already started, pid=${pid}" - exit -1; + pid=$(cat ${doris_cloud_home}/bin/${process}.pid) + if [ "${pid}" != "" ]; then + ps axu | grep "$pid" 2>&1 | grep doris_cloud >/dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "pid file existed, ${process} have already started, pid=${pid}" + exit -1 + fi fi - fi - echo "pid file existed but process not alive, remove it, pid=${pid}" - rm -f ${doris_cloud_home}/bin/${process}.pid + echo "pid file existed but process not alive, remove it, pid=${pid}" + rm -f ${doris_cloud_home}/bin/${process}.pid fi lib_path=${doris_cloud_home}/lib bin=${doris_cloud_home}/lib/doris_cloud -ldd ${bin} | grep -Ei 'libfdb_c.*not found' &> /dev/null +ldd ${bin} | grep -Ei 'libfdb_c.*not found' &>/dev/null if [ $? -eq 0 ]; then - if ! command -v patchelf &> /dev/null; then - echo "patchelf is needed to launch meta_service" - exit -1 - fi - patchelf --set-rpath ${lib_path} ${bin} - ldd ${bin} + if ! command -v patchelf &>/dev/null; then + echo "patchelf is needed to launch meta_service" + exit -1 + fi + patchelf --set-rpath ${lib_path} ${bin} + ldd ${bin} fi export JEMALLOC_CONF="percpu_arena:percpu,background_thread:true,metadata_thp:auto,muzzy_decay_ms:30000,dirty_decay_ms:30000,oversize_threshold:0,lg_tcache_max:16,prof:true,prof_prefix:jeprof.out" @@ -70,15 +70,15 @@ mkdir -p ${doris_cloud_home}/log echo "starts ${process} with args: $@" if [ ${daemonized} -eq 1 ]; then - date >> ${doris_cloud_home}/log/${process}.out - nohup ${bin} "$@" >> ${doris_cloud_home}/log/${process}.out 2>&1 & - # wait for log flush - sleep 1.5 - tail -n10 ${doris_cloud_home}/log/${process}.out | grep 'working directory' -B1 -A10 - echo "please check process log for more details" - echo "" + date >>${doris_cloud_home}/log/${process}.out + nohup ${bin} "$@" >>${doris_cloud_home}/log/${process}.out 2>&1 & + # wait for log flush + sleep 1.5 + tail -n10 ${doris_cloud_home}/log/${process}.out | grep 'working directory' -B1 -A10 + echo "please check process log for more details" + echo "" else - ${bin} "$@" + ${bin} "$@" fi # vim: et ts=2 sw=2: --- cloud/script/stop.sh.orig +++ cloud/script/stop.sh @@ -26,10 +26,10 @@ process=doris_cloud if [ ! -f ${doris_cloud_home}/bin/${process}.pid ]; then - echo "no ${process}.pid found, process may have been stopped" - exit -1 + echo "no ${process}.pid found, process may have been stopped" + exit -1 fi -pid=`cat ${doris_cloud_home}/bin/${process}.pid` +pid=$(cat ${doris_cloud_home}/bin/${process}.pid) kill -2 ${pid} rm -f ${doris_cloud_home}/bin/${process}.pid --- gensrc/script/gen_build_version.sh.orig +++ gensrc/script/gen_build_version.sh @@ -258,4 +258,3 @@ } // namespace doris::cloud EOF - --- run-cloud-ut.sh.orig +++ run-cloud-ut.sh @@ -32,14 +32,17 @@ # GTest result xml files will be in "cloud/ut_build_ASAN/gtest_output/" ##################################################################### -ROOT=`dirname "$0"` -ROOT=`cd "$ROOT"; pwd` +ROOT=$(dirname "$0") +ROOT=$( + cd "$ROOT" + pwd +) export DORIS_HOME=${ROOT} # Check args usage() { - echo " + echo " Usage: $0 <options> Optional options: --clean clean and build ut @@ -61,19 +64,19 @@ $0 --clean clean and build tests $0 --clean --run clean, build and run all tests " - exit 1 + exit 1 } -OPTS=$(getopt -n $0 -o vhj:f: -l run,clean,filter:,fdb:,coverage -- "$@") +OPTS=$(getopt -n $0 -o vhj:f: -l run,clean,filter:,fdb:,coverage -- "$@") if [ "$?" != "0" ]; then - usage + usage fi set -eo pipefail eval set -- "$OPTS" -PARALLEL=$[$(nproc)/5+1] +PARALLEL=$(($(nproc) / 5 + 1)) CLEAN=0 RUN=0 @@ -82,17 +85,41 @@ FDB="" ENABLE_CLANG_COVERAGE=OFF echo "===================== filter: ${FILTER}" -if [ $# != 1 ] ; then - while true; do +if [ $# != 1 ]; then + while true; do case "$1" in - --clean) CLEAN=1 ; shift ;; - --run) RUN=1 ; shift ;; - --coverage) ENABLE_CLANG_COVERAGE="ON"; shift ;; - --fdb) FDB="$2"; shift 2;; - -f | --filter) FILTER="$2"; shift 2;; - -j) PARALLEL=$2; shift 2 ;; - --) shift ; break ;; - *) usage ; exit 0 ;; + --clean) + CLEAN=1 + shift + ;; + --run) + RUN=1 + shift + ;; + --coverage) + ENABLE_CLANG_COVERAGE="ON" + shift + ;; + --fdb) + FDB="$2" + shift 2 + ;; + -f | --filter) + FILTER="$2" + shift 2 + ;; + -j) + PARALLEL=$2 + shift 2 + ;; + --) + shift + break + ;; + *) + usage + exit 0 + ;; esac done fi ---------- You can reformat the above files to meet shfmt's requirements by typing: shfmt -w filename ``` </details> -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org