github-actions[bot] commented on PR #39803: URL: https://github.com/apache/doris/pull/39803#issuecomment-2316839311
#### `sh-checker report` To get the full details, please check in the [job]("https://github.com/apache/doris/actions/runs/10610127800") output. <details> <summary>shellcheck errors</summary> ``` 'shellcheck ' returned error 1 finding the following syntactical issues: ---------- In tools/fdb/fdb_ctrl.sh line 29: ROOT_DIR="$(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: ROOT_DIR="$(cd "$(dirname $(readlink -f "${BASH_SOURCE[0]}"))" &>/dev/null && pwd)" In tools/fdb/fdb_ctrl.sh line 31: if [ -f ${ROOT_DIR}/fdb_vars.sh ]; then ^----------------------------^ SC2292 (style): Prefer [[ ]] over [ ] for tests in Bash/Ksh. ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if [[ -f "${ROOT_DIR}"/fdb_vars.sh ]]; then In tools/fdb/fdb_ctrl.sh line 32: source ${ROOT_DIR}/fdb_vars.sh ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: source "${ROOT_DIR}"/fdb_vars.sh In tools/fdb/fdb_ctrl.sh line 38: if [ ! -d ${FDB_HOME} ]; 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 [[ ! -d "${FDB_HOME}" ]]; then In tools/fdb/fdb_ctrl.sh line 44: echo "$FDB_HOME is not an absolute path." ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "${FDB_HOME} is not an absolute path." In tools/fdb/fdb_ctrl.sh line 48: if [ -z ${FDB_CLUSTER_ID} ]; 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 [[ -z "${FDB_CLUSTER_ID}" ]]; then In tools/fdb/fdb_ctrl.sh line 64: mkdir -p ${LOG_DIR} ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mkdir -p "${LOG_DIR}" In tools/fdb/fdb_ctrl.sh line 65: mkdir -p ${FDB_HOME}/conf ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: mkdir -p "${FDB_HOME}"/conf In tools/fdb/fdb_ctrl.sh line 66: mkdir -p ${FDB_HOME}/log ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: mkdir -p "${FDB_HOME}"/log In tools/fdb/fdb_ctrl.sh line 72: if lsof -nP -iTCP:${port} -sTCP:LISTEN >/dev/null; then ^-----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if lsof -nP -iTCP:"${port}" -sTCP:LISTEN >/dev/null; then In tools/fdb/fdb_ctrl.sh line 79: if [ -d ${FDB_PKG_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 "${FDB_PKG_DIR}" ]]; then In tools/fdb/fdb_ctrl.sh line 87: rm -rf ${TMP} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: rm -rf "${TMP}" In tools/fdb/fdb_ctrl.sh line 88: mkdir -p ${TMP} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mkdir -p "${TMP}" In tools/fdb/fdb_ctrl.sh line 90: wget ${URL}/fdbbackup.x86_64 -O ${TMP}/fdbbackup ^----^ 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: wget "${URL}"/fdbbackup.x86_64 -O "${TMP}"/fdbbackup In tools/fdb/fdb_ctrl.sh line 91: wget ${URL}/fdbserver.x86_64 -O ${TMP}/fdbserver ^----^ 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: wget "${URL}"/fdbserver.x86_64 -O "${TMP}"/fdbserver In tools/fdb/fdb_ctrl.sh line 92: wget ${URL}/fdbcli.x86_64 -O ${TMP}/fdbcli ^----^ 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: wget "${URL}"/fdbcli.x86_64 -O "${TMP}"/fdbcli In tools/fdb/fdb_ctrl.sh line 93: wget ${URL}/fdbmonitor.x86_64 -O ${TMP}/fdbmonitor ^----^ 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: wget "${URL}"/fdbmonitor.x86_64 -O "${TMP}"/fdbmonitor In tools/fdb/fdb_ctrl.sh line 94: wget ${URL}/libfdb_c.x86_64.so -O ${TMP}/libfdb_c.x86_64.so ^----^ 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: wget "${URL}"/libfdb_c.x86_64.so -O "${TMP}"/libfdb_c.x86_64.so In tools/fdb/fdb_ctrl.sh line 95: chmod +x ${TMP}/fdb* ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: chmod +x "${TMP}"/fdb* In tools/fdb/fdb_ctrl.sh line 97: mv ${TMP} ${FDB_PKG_DIR} ^----^ SC2086 (info): Double quote to prevent globbing and word splitting. ^------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: mv "${TMP}" "${FDB_PKG_DIR}" In tools/fdb/fdb_ctrl.sh line 103: local num_nodes=$(echo "$FDB_CLUSTER_IPS" | tr ',' '\n' | wc -l) ^-------^ SC2155 (warning): Declare and assign separately to avoid masking return values. ^--------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: local num_nodes=$(echo "${FDB_CLUSTER_IPS}" | tr ',' '\n' | wc -l) In tools/fdb/fdb_ctrl.sh line 106: if [[ $num_nodes -le 2 ]]; then ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${num_nodes} -le 2 ]]; then In tools/fdb/fdb_ctrl.sh line 108: elif [[ $num_nodes -le 4 ]]; then ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: elif [[ ${num_nodes} -le 4 ]]; then In tools/fdb/fdb_ctrl.sh line 114: echo $FDB_CLUSTER_IPS | cut -d',' -f1-$num_coordinators | tr ',' '\n' | sed "s/$/:$FDB_PORT/" | paste -sd ',' ^--------------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^--------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---------------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "${FDB_CLUSTER_IPS}" | cut -d',' -f1-"${num_coordinators}" | tr ',' '\n' | sed "s/$/:${FDB_PORT}/" | paste -sd ',' In tools/fdb/fdb_ctrl.sh line 119: local num_nodes=$(echo "$FDB_CLUSTER_IPS" | tr ',' '\n' | wc -l) ^-------^ SC2155 (warning): Declare and assign separately to avoid masking return values. ^--------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: local num_nodes=$(echo "${FDB_CLUSTER_IPS}" | tr ',' '\n' | wc -l) In tools/fdb/fdb_ctrl.sh line 122: if [[ $num_nodes -eq 1 ]]; then ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${num_nodes} -eq 1 ]]; then In tools/fdb/fdb_ctrl.sh line 124: elif [[ $num_nodes -le 4 ]]; then ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: elif [[ ${num_nodes} -le 4 ]]; then In tools/fdb/fdb_ctrl.sh line 130: echo $fdb_mode ^-------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "${fdb_mode}" In tools/fdb/fdb_ctrl.sh line 135: local memory_gb=$1 ^-------^ SC2034 (warning): memory_gb appears unused. Verify use (or export if used externally). In tools/fdb/fdb_ctrl.sh line 142: IFS=',' read -r -a DATA_DIR_ARRAY <<< "$DATA_DIRS" ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: IFS=',' read -r -a DATA_DIR_ARRAY <<< "${DATA_DIRS}" In tools/fdb/fdb_ctrl.sh line 147: [[ $STATLESS_PROCESSES -lt $min_processes ]] && STATLESS_PROCESSES=$min_processes ^-----------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ ${STATLESS_PROCESSES} -lt ${min_processes} ]] && STATLESS_PROCESSES=${min_processes} In tools/fdb/fdb_ctrl.sh line 151: [[ $STORAGE_PROCESSES -lt $data_dir_count ]] && STORAGE_PROCESSES=$data_dir_count ^----------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ ${STORAGE_PROCESSES} -lt ${data_dir_count} ]] && STORAGE_PROCESSES=${data_dir_count} In tools/fdb/fdb_ctrl.sh line 156: [[ $TRANSACTION_PROCESSES -lt $min_processes ]] && TRANSACTION_PROCESSES=$min_processes ^--------------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ ${TRANSACTION_PROCESSES} -lt ${min_processes} ]] && TRANSACTION_PROCESSES=${min_processes} In tools/fdb/fdb_ctrl.sh line 157: [[ $TRANSACTION_PROCESSES -lt $data_dir_count ]] && TRANSACTION_PROCESSES=$data_dir_count ^--------------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: [[ ${TRANSACTION_PROCESSES} -lt ${data_dir_count} ]] && TRANSACTION_PROCESSES=${data_dir_count} In tools/fdb/fdb_ctrl.sh line 160: echo "Stateless Processes: $STATLESS_PROCESSES" ^-----------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "Stateless Processes: ${STATLESS_PROCESSES}" In tools/fdb/fdb_ctrl.sh line 161: echo "Storage Processes: $STORAGE_PROCESSES" ^----------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "Storage Processes: ${STORAGE_PROCESSES}" In tools/fdb/fdb_ctrl.sh line 162: echo "Transaction Processes: $TRANSACTION_PROCESSES" ^--------------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "Transaction Processes: ${TRANSACTION_PROCESSES}" In tools/fdb/fdb_ctrl.sh line 168: ln -sf ${FDB_PKG_DIR}/fdbserver ${FDB_HOME}/fdbserver ^------------^ 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: ln -sf "${FDB_PKG_DIR}"/fdbserver "${FDB_HOME}"/fdbserver In tools/fdb/fdb_ctrl.sh line 169: ln -sf ${FDB_PKG_DIR}/fdbmonitor ${FDB_HOME}/fdbmonitor ^------------^ 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: ln -sf "${FDB_PKG_DIR}"/fdbmonitor "${FDB_HOME}"/fdbmonitor In tools/fdb/fdb_ctrl.sh line 170: ln -sf ${FDB_PKG_DIR}/fdbbackup ${FDB_HOME}/backup_agent ^------------^ 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: ln -sf "${FDB_PKG_DIR}"/fdbbackup "${FDB_HOME}"/backup_agent In tools/fdb/fdb_ctrl.sh line 171: ln -sf ${FDB_PKG_DIR}/fdbcli ${FDB_HOME}/fdbcli ^------------^ 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: ln -sf "${FDB_PKG_DIR}"/fdbcli "${FDB_HOME}"/fdbcli In tools/fdb/fdb_ctrl.sh line 173: CLUSTER_DESC=${FDB_CLUSTER_DESC:-$FDB_CLUSTER_ID} ^-------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: CLUSTER_DESC=${FDB_CLUSTER_DESC:-${FDB_CLUSTER_ID}} In tools/fdb/fdb_ctrl.sh line 176: IFS=',' read -r -a DATA_DIR_ARRAY <<< "$DATA_DIRS" ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: IFS=',' read -r -a DATA_DIR_ARRAY <<< "${DATA_DIRS}" In tools/fdb/fdb_ctrl.sh line 178: mkdir -p $DIR || handle_error "Failed to create data directory $DIR" ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: mkdir -p "${DIR}" || handle_error "Failed to create data directory ${DIR}" In tools/fdb/fdb_ctrl.sh line 183: cat >${FDB_HOME}/conf/fdb.cluster <<EOF ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: cat >"${FDB_HOME}"/conf/fdb.cluster <<EOF In tools/fdb/fdb_ctrl.sh line 187: cat >${FDB_HOME}/conf/fdb.conf <<EOF ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: cat >"${FDB_HOME}"/conf/fdb.conf <<EOF In tools/fdb/fdb_ctrl.sh line 211: calculate_process_numbers $MEMORY_LIMIT_GB $CPU_CORES_LIMIT ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^--------------^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--------------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: calculate_process_numbers "${MEMORY_LIMIT_GB}" "${CPU_CORES_LIMIT}" In tools/fdb/fdb_ctrl.sh line 216: echo "[fdbserver.$PORT] ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "[fdbserver.${PORT}] In tools/fdb/fdb_ctrl.sh line 217: class = stateless" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: class = stateless" | tee -a "${FDB_HOME}"/conf/fdb.conf > /dev/null In tools/fdb/fdb_ctrl.sh line 227: echo "[fdbserver.$PORT] ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "[fdbserver.${PORT}] In tools/fdb/fdb_ctrl.sh line 229: datadir = ${DATA_DIR_ARRAY[$DIR_INDEX]}/$PORT" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: datadir = ${DATA_DIR_ARRAY[${DIR_INDEX}]}/${PORT}" | tee -a "${FDB_HOME}"/conf/fdb.conf > /dev/null In tools/fdb/fdb_ctrl.sh line 238: echo "[fdbserver.$PORT] ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: echo "[fdbserver.${PORT}] In tools/fdb/fdb_ctrl.sh line 240: datadir = ${DATA_DIR_ARRAY[$DIR_INDEX]}/$PORT" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null ^--------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: datadir = ${DATA_DIR_ARRAY[${DIR_INDEX}]}/${PORT}" | tee -a "${FDB_HOME}"/conf/fdb.conf > /dev/null In tools/fdb/fdb_ctrl.sh line 245: logdir = ${LOG_DIR}" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: logdir = ${LOG_DIR}" | tee -a "${FDB_HOME}"/conf/fdb.conf > /dev/null In tools/fdb/fdb_ctrl.sh line 251: if [ ! -f ${FDB_HOME}/fdbmonitor ]; 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 [[ ! -f "${FDB_HOME}"/fdbmonitor ]]; then In tools/fdb/fdb_ctrl.sh line 256: ensure_port_is_listenable "fdbserver" ${FDB_PORT} ^---------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ensure_port_is_listenable "fdbserver" "${FDB_PORT}" In tools/fdb/fdb_ctrl.sh line 259: ${FDB_HOME}/fdbmonitor \ ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: "${FDB_HOME}"/fdbmonitor \ In tools/fdb/fdb_ctrl.sh line 260: --conffile ${FDB_HOME}/conf/fdb.conf \ ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: --conffile "${FDB_HOME}"/conf/fdb.conf \ In tools/fdb/fdb_ctrl.sh line 261: --lockfile ${FDB_HOME}/fdbmonitor.pid \ ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: --lockfile "${FDB_HOME}"/fdbmonitor.pid \ In tools/fdb/fdb_ctrl.sh line 266: if [ -f ${FDB_HOME}/fdbmonitor.pid ]; 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 [[ -f "${FDB_HOME}"/fdbmonitor.pid ]]; then In tools/fdb/fdb_ctrl.sh line 267: local fdb_pid=$(cat ${FDB_HOME}/fdbmonitor.pid) ^-----^ SC2155 (warning): Declare and assign separately to avoid masking return values. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: local fdb_pid=$(cat "${FDB_HOME}"/fdbmonitor.pid) In tools/fdb/fdb_ctrl.sh line 268: if ps -p ${fdb_pid} >/dev/null; then ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ps -p "${fdb_pid}" >/dev/null; then In tools/fdb/fdb_ctrl.sh line 270: kill -9 ${fdb_pid} ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: kill -9 "${fdb_pid}" In tools/fdb/fdb_ctrl.sh line 276: if [ -f ${FDB_HOME}/fdbmonitor.pid ]; 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 [[ -f "${FDB_HOME}"/fdbmonitor.pid ]]; then In tools/fdb/fdb_ctrl.sh line 277: local fdb_pid=$(cat ${FDB_HOME}/fdbmonitor.pid) ^-----^ SC2155 (warning): Declare and assign separately to avoid masking return values. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: local fdb_pid=$(cat "${FDB_HOME}"/fdbmonitor.pid) In tools/fdb/fdb_ctrl.sh line 278: if ps -p ${fdb_pid} >/dev/null; then ^--------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: if ps -p "${fdb_pid}" >/dev/null; then In tools/fdb/fdb_ctrl.sh line 285: rm -rf ${FDB_HOME}/* ^-----------^ SC2115 (warning): Use "${var:?}" to ensure this never expands to /* . ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: rm -rf "${FDB_HOME}"/* In tools/fdb/fdb_ctrl.sh line 293: if [[ $job =~ ^(all|fdb)$ ]]; then ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${job} =~ ^(all|fdb)$ ]]; then In tools/fdb/fdb_ctrl.sh line 302: if [[ $job =~ ^(all|fdb)$ ]]; then ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${job} =~ ^(all|fdb)$ ]]; then In tools/fdb/fdb_ctrl.sh line 306: if [[ $init =~ ^(all|fdb)$ ]]; then ^---^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${init} =~ ^(all|fdb)$ ]]; then In tools/fdb/fdb_ctrl.sh line 308: local fdb_mode=$(get_fdb_mode) ^------^ SC2155 (warning): Declare and assign separately to avoid masking return values. In tools/fdb/fdb_ctrl.sh line 309: ${FDB_HOME}/fdbcli -C ${FDB_HOME}/conf/fdb.cluster \ ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: "${FDB_HOME}"/fdbcli -C "${FDB_HOME}"/conf/fdb.cluster \ In tools/fdb/fdb_ctrl.sh line 314: cat ${FDB_HOME}/conf/fdb.cluster ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. Did you mean: cat "${FDB_HOME}"/conf/fdb.cluster In tools/fdb/fdb_ctrl.sh line 320: if [[ $job =~ ^(all|fdb)$ ]]; then ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${job} =~ ^(all|fdb)$ ]]; then In tools/fdb/fdb_ctrl.sh line 329: if [[ $job =~ ^(all|fdb)$ ]]; then ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: if [[ ${job} =~ ^(all|fdb)$ ]]; then In tools/fdb/fdb_ctrl.sh line 336: ps -ef | grep ${FDB_CLUSTER_DESC} | grep -v grep ^----^ SC2009 (info): Consider using pgrep instead of grepping ps output. ^-----------------^ SC2086 (info): Double quote to prevent globbing and word splitting. Did you mean: ps -ef | grep "${FDB_CLUSTER_DESC}" | grep -v grep In tools/fdb/fdb_ctrl.sh line 357: echo "Unknown cmd: ${cmd}\n" ^---------------------^ SC2028 (info): echo may not expand escape sequences. Use printf. In tools/fdb/fdb_ctrl.sh line 361: if [[ $# < 1 ]]; then ^-- SC2071 (error): < is for string comparisons. Use -lt instead. In tools/fdb/fdb_ctrl.sh line 374: case $cmd in ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: case ${cmd} in In tools/fdb/fdb_ctrl.sh line 376: deploy "$job" $skip_pkg $skip_config ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^-------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^-------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. ^----------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^----------^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: deploy "${job}" "${skip_pkg}" "${skip_config}" In tools/fdb/fdb_ctrl.sh line 379: start "$job" "${init}" ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: start "${job}" "${init}" In tools/fdb/fdb_ctrl.sh line 382: stop "$job" ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: stop "${job}" In tools/fdb/fdb_ctrl.sh line 385: clean "$job" ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: clean "${job}" In tools/fdb/fdb_ctrl.sh line 388: ${FDB_HOME}/fdbcli -C ${FDB_HOME}/conf/fdb.cluster $@ ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^---------^ SC2248 (style): Prefer double quoting even when variables don't contain special characters. ^-- SC2068 (error): Double quote array expansions to avoid re-splitting elements. Did you mean: "${FDB_HOME}"/fdbcli -C "${FDB_HOME}"/conf/fdb.cluster $@ In tools/fdb/fdb_ctrl.sh line 394: unknown_cmd $cmd ^--^ SC2086 (info): Double quote to prevent globbing and word splitting. ^--^ SC2250 (style): Prefer putting braces around variable references even when not strictly required. Did you mean: unknown_cmd "${cmd}" In tools/fdb/fdb_vars.sh line 1: # Licensed to the Apache Software Foundation (ASF) under one ^-- SC2148 (error): Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. In tools/fdb/fdb_vars.sh line 25: DATA_DIRS="/mnt/foundationdb/data1,/mnt/foundationdb/data2,/mnt/foundationdb/data3" ^-------^ SC2034 (warning): DATA_DIRS appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 33: FDB_CLUSTER_IPS="172.200.0.2,172.200.0.3,172.200.0.4" ^-------------^ SC2034 (warning): FDB_CLUSTER_IPS appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 38: FDB_HOME="/fdbhome" ^------^ SC2034 (warning): FDB_HOME appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 42: FDB_CLUSTER_ID="SAQESzbh" ^------------^ SC2034 (warning): FDB_CLUSTER_ID appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 45: FDB_CLUSTER_DESC="mycluster" ^--------------^ SC2034 (warning): FDB_CLUSTER_DESC appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 50: MEMORY_LIMIT_GB=16 ^-------------^ SC2034 (warning): MEMORY_LIMIT_GB appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 53: CPU_CORES_LIMIT=8 ^-------------^ SC2034 (warning): CPU_CORES_LIMIT appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 58: FDB_PORT=4500 ^------^ SC2034 (warning): FDB_PORT appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 61: FDB_VERSION="7.1.38" ^---------^ SC2034 (warning): FDB_VERSION appears unused. Verify use (or export if used externally). In tools/fdb/fdb_vars.sh line 64: USER=`whoami` ^------^ SC2006 (style): Use $(...) notation instead of legacy backticks `...`. Did you mean: USER=$(whoami) For more information: https://www.shellcheck.net/wiki/SC2068 -- Double quote array expansions to ... https://www.shellcheck.net/wiki/SC2071 -- < is for string comparisons. Use ... https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y... ---------- 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: ---------- --- tools/fdb/fdb_ctrl.sh.orig +++ tools/fdb/fdb_ctrl.sh @@ -139,7 +139,7 @@ local data_dir_count # Convert comma-separated DATA_DIRS into an array - IFS=',' read -r -a DATA_DIR_ARRAY <<< "$DATA_DIRS" + IFS=',' read -r -a DATA_DIR_ARRAY <<<"$DATA_DIRS" data_dir_count=${#DATA_DIR_ARRAY[@]} # Stateless processes (at least 1, up to 1/4 of CPU cores) @@ -149,13 +149,13 @@ # Storage processes (must be a multiple of the number of data directories) STORAGE_PROCESSES=$((cpu_cores / 4)) [[ $STORAGE_PROCESSES -lt $data_dir_count ]] && STORAGE_PROCESSES=$data_dir_count - STORAGE_PROCESSES=$(( (STORAGE_PROCESSES / data_dir_count) * data_dir_count )) + STORAGE_PROCESSES=$(((STORAGE_PROCESSES / data_dir_count) * data_dir_count)) # Transaction processes (must be a multiple of the number of data directories) TRANSACTION_PROCESSES=$((cpu_cores / 8)) [[ $TRANSACTION_PROCESSES -lt $min_processes ]] && TRANSACTION_PROCESSES=$min_processes [[ $TRANSACTION_PROCESSES -lt $data_dir_count ]] && TRANSACTION_PROCESSES=$data_dir_count - TRANSACTION_PROCESSES=$(( (TRANSACTION_PROCESSES / data_dir_count) * data_dir_count )) + TRANSACTION_PROCESSES=$(((TRANSACTION_PROCESSES / data_dir_count) * data_dir_count)) echo "Stateless Processes: $STATLESS_PROCESSES" echo "Storage Processes: $STORAGE_PROCESSES" @@ -173,9 +173,9 @@ CLUSTER_DESC=${FDB_CLUSTER_DESC:-$FDB_CLUSTER_ID} # Convert comma-separated DATA_DIRS into an array - IFS=',' read -r -a DATA_DIR_ARRAY <<< "$DATA_DIRS" + IFS=',' read -r -a DATA_DIR_ARRAY <<<"$DATA_DIRS" for DIR in "${DATA_DIR_ARRAY[@]}"; do - mkdir -p $DIR || handle_error "Failed to create data directory $DIR" + mkdir -p $DIR || handle_error "Failed to create data directory $DIR" done echo -e "\tCreate fdb.cluster, coordinator: $(get_coordinators)" @@ -214,7 +214,7 @@ for ((i = 0; i < STATLESS_PROCESSES; i++)); do PORT=$((FDB_PORT + i)) echo "[fdbserver.$PORT] -class = stateless" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null +class = stateless" | tee -a ${FDB_HOME}/conf/fdb.conf >/dev/null done FDB_PORT=$((FDB_PORT + STATLESS_PROCESSES)) @@ -226,7 +226,7 @@ DIR_INDEX=$((i % STORAGE_DIR_COUNT)) echo "[fdbserver.$PORT] class = storage -datadir = ${DATA_DIR_ARRAY[$DIR_INDEX]}/$PORT" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null +datadir = ${DATA_DIR_ARRAY[$DIR_INDEX]}/$PORT" | tee -a ${FDB_HOME}/conf/fdb.conf >/dev/null done FDB_PORT=$((FDB_PORT + STORAGE_PROCESSES)) @@ -237,12 +237,12 @@ DIR_INDEX=$((i % STORAGE_DIR_COUNT)) echo "[fdbserver.$PORT] class = transaction -datadir = ${DATA_DIR_ARRAY[$DIR_INDEX]}/$PORT" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null +datadir = ${DATA_DIR_ARRAY[$DIR_INDEX]}/$PORT" | tee -a ${FDB_HOME}/conf/fdb.conf >/dev/null done echo "[backup_agent] command = ${FDB_HOME}/backup_agent -logdir = ${LOG_DIR}" | tee -a ${FDB_HOME}/conf/fdb.conf > /dev/null +logdir = ${LOG_DIR}" | tee -a ${FDB_HOME}/conf/fdb.conf >/dev/null echo "Deploy FDB to: ${FDB_HOME}" } @@ -372,26 +372,25 @@ skip_config="false" case $cmd in - deploy) - deploy "$job" $skip_pkg $skip_config - ;; - start) - start "$job" "${init}" - ;; - stop) - stop "$job" - ;; - clean) - clean "$job" - ;; - fdbcli) - ${FDB_HOME}/fdbcli -C ${FDB_HOME}/conf/fdb.cluster $@ - ;; - config) - generate_regression_config true - ;; - *) - unknown_cmd $cmd - ;; +deploy) + deploy "$job" $skip_pkg $skip_config + ;; +start) + start "$job" "${init}" + ;; +stop) + stop "$job" + ;; +clean) + clean "$job" + ;; +fdbcli) + ${FDB_HOME}/fdbcli -C ${FDB_HOME}/conf/fdb.cluster $@ + ;; +config) + generate_regression_config true + ;; +*) + unknown_cmd $cmd + ;; esac - --- tools/fdb/fdb_vars.sh.orig +++ tools/fdb/fdb_vars.sh @@ -32,7 +32,6 @@ FDB_CLUSTER_IPS="172.200.0.2,172.200.0.3,172.200.0.4" - # Define the FoundationDB home directory, which contains the fdb binaries and logs. # default is /fdbhome and have to be absolute path. FDB_HOME="/fdbhome" @@ -61,4 +60,4 @@ FDB_VERSION="7.1.38" # Users who run the fdb processes, default is the current user -USER=`whoami` +USER=$(whoami) ---------- 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