github-actions[bot] commented on PR #30054: URL: https://github.com/apache/doris/pull/30054#issuecomment-1895236312
#### `sh-checker report` To get the full details, please check in the [job]("https://github.com/apache/doris/actions/runs/7552446947") output. <details> <summary>shellcheck errors</summary> ``` 'shellcheck ' returned error 1 finding the following syntactical issues: ---------- In build.sh line 567: MAKE_PROGRAM="$(which "${BUILD_SYSTEM}")" ^---^ SC2230 (info): 'which' is non-standard. Use builtin 'command -v' instead. 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 25: if [[ "$?" != "0" ]]; then ^--^ SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. 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 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 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 90: patchelf --set-rpath `pwd` "${i}" ^---^ SC2046 (warning): Quote this to prevent word splitting. ^---^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`. Did you mean: patchelf --set-rpath $(pwd) "${i}" 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. 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. 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 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 46: if ! ps axu | grep "$pid" 2>&1 | grep doris_cloud > /dev/null 2>&1; then ^----^ 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: if ! ps axu | grep "${pid}" 2>&1 | grep doris_cloud > /dev/null 2>&1; then In cloud/script/start.sh line 48: 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 60: 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 69: echo "starts ${process} with args: $@" ^-- SC2145 (error): Argument mixes string and array. Use * or separate argument. 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. Did you mean: cd "${doris_cloud_home}" || exit 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 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/SC2145 -- Argument mixes string and array. ... https://www.shellcheck.net/wiki/SC2242 -- Can only exit with status 0-255. ... ---------- 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 @@ -553,7 +553,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 @@ -569,26 +569,25 @@ 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 -- "$@") 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,50 +17,50 @@ # 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 - if ! ps axu | grep "$pid" 2>&1 | grep doris_cloud > /dev/null 2>&1; then - echo "pid file existed, ${process} have already started, pid=${pid}" - exit -1; + pid=$(cat ${doris_cloud_home}/bin/${process}.pid) + if [[ "${pid}" != "" ]]; then + if ! ps axu | grep "$pid" 2>&1 | grep doris_cloud >/dev/null 2>&1; 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" -if ! ldd "${bin}" | grep -Ei 'libfdb_c.*not found' &> /dev/null; 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 ! ldd "${bin}" | grep -Ei 'libfdb_c.*not found' &>/dev/null; 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}" 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" @@ -68,15 +68,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