github-actions[bot] commented on PR #30054: URL: https://github.com/apache/doris/pull/30054#issuecomment-1895268770
#### `sh-checker report` To get the full details, please check in the [job]("https://github.com/apache/doris/actions/runs/7552576028") 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/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/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 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/SC2034 -- BUILD_BENCHMARK_TOOL appears unus... https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt... https://www.shellcheck.net/wiki/SC2154 -- user is referenced but not assign... ---------- 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 @@ -32,32 +32,32 @@ fdb_conf="" filter="" ENABLE_CLANG_COVERAGE="OFF" -if [[ $# != 1 ]] ; then +if [[ $# != 1 ]]; then while true; do case "$1" in - --coverage) - ENABLE_CLANG_COVERAGE="ON" - shift 1 + --coverage) + ENABLE_CLANG_COVERAGE="ON" + shift 1 ;; - --test) - test="$2" - shift 2 + --test) + test="$2" + shift 2 ;; - --fdb) - fdb_conf="$2" - shift 2 + --fdb) + fdb_conf="$2" + shift 2 ;; - --filter) - filter="$2" - shift 2 + --filter) + filter="$2" + shift 2 ;; - --) - shift - break + --) + shift + break ;; - *) - usage - exit 1 + *) + usage + exit 1 ;; esac done @@ -71,13 +71,12 @@ if [[ "${fdb_conf}" != "" ]]; then echo "update fdb_cluster.conf with \"${fdb_conf}\"" - echo "${fdb_conf}" > fdb.cluster + echo "${fdb_conf}" >fdb.cluster fi # report converage for unittest # input param is unittest binary file list -function report_coverage() -{ +function report_coverage() { local binary_objects=$1 local profdata="./report/doris_cloud.profdata" profraw=$(ls ./report/*.profraw) @@ -87,9 +86,9 @@ 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[*]}" + -ignore-filename-regex='(.*gensrc/.*)|(.*_test\.cpp$)' \ + -instr-profile="${profdata}" \ + "${binary_objects_options[*]}" } export LSAN_OPTIONS=suppressions=./lsan_suppression.conf @@ -98,7 +97,7 @@ [[ -e "${i}" ]] || break if [[ "${test}" != "" ]]; then if [[ "${test}" != "${i}" ]]; then - continue; + continue fi fi if [[ -x "${i}" ]]; then @@ -107,7 +106,7 @@ 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 @@ -118,7 +117,7 @@ fi done -if [[ "_${ENABLE_CLANG_COVERAGE}" == "_ON" ]];then +if [[ "_${ENABLE_CLANG_COVERAGE}" == "_ON" ]]; then report_coverage "${unittest_files[*]}" fi --- cloud/script/start.sh.orig +++ cloud/script/start.sh @@ -29,7 +29,7 @@ fi daemonized=0 -for arg do +for arg; do shift [[ "${arg}" = "--daemonized" ]] && daemonized=1 && continue [[ "${arg}" = "-daemonized" ]] && daemonized=1 && continue @@ -43,7 +43,7 @@ if [[ -f "${doris_cloud_home}/bin/${process}.pid" ]]; then pid=$(cat "${doris_cloud_home}/bin/${process}.pid") if [[ "${pid}" != "" ]]; then - if ! pgrep -f "${pid}" 2>&1 | grep doris_cloud > /dev/null 2>&1; then + if ! pgrep -f "${pid}" 2>&1 | grep doris_cloud >/dev/null 2>&1; then echo "pid file existed, ${process} have already started, pid=${pid}" exit 1 fi @@ -54,8 +54,8 @@ 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 +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 @@ -68,8 +68,8 @@ 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 & + 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 --- 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