From ed05890cab7349406e0b28751bc9dd481814061e Mon Sep 17 00:00:00 2001 From: bizhiyuan Date: Fri, 31 Oct 2025 14:19:41 +0800 Subject: [PATCH] Fix shellcheck errors on output redirection [SC2328] All agents: use detected grep -E/-F instead of egrep/fgrep (cherry picked from commit ea54e2b759f66a59c93451d90a51b3f08a375e9e) --- ...etected-grep-E-F-instead-of-egrep-fg.patch | 246 ++++++++++++++++++ ...-errors-on-output-redirection-SC2328.patch | 192 ++++++++++++++ resource-agents.spec | 8 +- 3 files changed, 445 insertions(+), 1 deletion(-) create mode 100644 backport-All-agents-use-detected-grep-E-F-instead-of-egrep-fg.patch create mode 100644 backport-Fix-shellcheck-errors-on-output-redirection-SC2328.patch diff --git a/backport-All-agents-use-detected-grep-E-F-instead-of-egrep-fg.patch b/backport-All-agents-use-detected-grep-E-F-instead-of-egrep-fg.patch new file mode 100644 index 0000000..dd0bec8 --- /dev/null +++ b/backport-All-agents-use-detected-grep-E-F-instead-of-egrep-fg.patch @@ -0,0 +1,246 @@ +From 618ee5d013b6f4caeb703ffee6d2d696db887a1f Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Tue, 21 Jan 2025 10:07:46 +0100 +Subject: [PATCH] All agents: use detected grep -E/-F instead of egrep/fgrep + when detected + +--- + configure.ac | 4 ++-- + heartbeat/IPaddr2 | 2 +- + heartbeat/ManageVE.in | 2 +- + heartbeat/SAPInstance | 2 +- + heartbeat/VirtualDomain | 4 ++-- + heartbeat/WAS | 2 +- + heartbeat/WAS6 | 2 +- + heartbeat/docker | 2 +- + heartbeat/eDir88.in | 2 +- + heartbeat/mysql-proxy | 2 +- + heartbeat/portblock | 2 +- + heartbeat/rabbitmq-server-ha | 2 +- + heartbeat/sapdb.sh | 2 +- + heartbeat/smb-share.in | 4 ++-- + heartbeat/symlink | 2 +- + 15 files changed, 18 insertions(+), 18 deletions(-) + +diff --git a/configure.ac b/configure.ac +index 951a0543..bb2bbade 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -492,12 +492,12 @@ AC_PATH_PROGS(TEST, test) + AC_PATH_PROGS(PING, ping, /bin/ping) + AC_PATH_PROGS(IFCONFIG, ifconfig, /sbin/ifconfig) + AC_PATH_PROGS(MAILCMD, mailx mail, mail) +-AC_PATH_PROGS(EGREP, egrep) + AC_PATH_PROGS(RM, rm) ++AC_PROG_EGREP ++AC_PROG_FGREP + + AC_SUBST(BASH_SHELL) + AC_SUBST(MAILCMD) +-AC_SUBST(EGREP) + AC_SUBST(SHELL) + AC_SUBST(PING) + AC_SUBST(RM) +diff --git a/heartbeat/IPaddr2 b/heartbeat/IPaddr2 +index 27cae2d1..489826b8 100755 +--- a/heartbeat/IPaddr2 ++++ b/heartbeat/IPaddr2 +@@ -1028,7 +1028,7 @@ ip_served() { + echo "partial2" + return 0 + fi +- if egrep -q "(^|,)${IP_INC_NO}(,|$)" $IP_CIP_FILE ; then ++ if $EGREP -q "(^|,)${IP_INC_NO}(,|$)" $IP_CIP_FILE ; then + echo "ok" + return 0 + else +diff --git a/heartbeat/ManageVE.in b/heartbeat/ManageVE.in +index f07ca5bd..540addd9 100644 +--- a/heartbeat/ManageVE.in ++++ b/heartbeat/ManageVE.in +@@ -273,7 +273,7 @@ esac + declare -i veidtest1=$? + + # really a number? +-`echo "$OCF_RESKEY_veid" | egrep -q '^[[:digit:]]+$'` ++`echo "$OCF_RESKEY_veid" | $EGREP -q '^[[:digit:]]+$'` + + if [[ $veidtest1 != 1 || $? != 0 ]]; then + ocf_log err "OCF_RESKEY_veid not set or not a number." +diff --git a/heartbeat/SAPInstance b/heartbeat/SAPInstance +index 26fd5413..95140e9c 100755 +--- a/heartbeat/SAPInstance ++++ b/heartbeat/SAPInstance +@@ -795,7 +795,7 @@ sapinstance_monitor() { + esac + + SEARCH=`echo "$OCF_RESKEY_MONITOR_SERVICES" | sed 's/\+/\\\+/g' | sed 's/\./\\\./g'` +- if [ `echo "$SERVICE" | egrep -c "$SEARCH"` -eq 1 ] ++ if [ `echo "$SERVICE" | $EGREP -c "$SEARCH"` -eq 1 ] + then + if [ $STATE -eq $OCF_NOT_RUNNING ] + then +diff --git a/heartbeat/VirtualDomain b/heartbeat/VirtualDomain +index 3905695a..7db42bd1 100755 +--- a/heartbeat/VirtualDomain ++++ b/heartbeat/VirtualDomain +@@ -975,7 +975,7 @@ VirtualDomain_migrate_to() { + sed "s/%n/$target_node/g"` + + # extract migrationuri from options +- elif echo "$migrate_opts" | fgrep -qs -- "--migrateuri="; then ++ elif echo "$migrate_opts" | $FGREP -qs -- "--migrateuri="; then + migrateuri=`echo "$migrate_opts" | + sed "s/.*--migrateuri=\([^ ]*\).*/\1/;s/%n/$target_node/g"` + +@@ -1148,7 +1148,7 @@ VirtualDomain_getconfig() { + VIRSH_OPTIONS="--connect=${OCF_RESKEY_hypervisor} --quiet" + + # Retrieve the domain name from the xml file. +- DOMAIN_NAME=`egrep '[[:space:]]*.*[[:space:]]*$' ${OCF_RESKEY_config} 2>/dev/null | sed -e 's/[[:space:]]*\(.*\)<\/name>[[:space:]]*$/\1/'` ++ DOMAIN_NAME=`$EGREP '[[:space:]]*.*[[:space:]]*$' ${OCF_RESKEY_config} 2>/dev/null | sed -e 's/[[:space:]]*\(.*\)<\/name>[[:space:]]*$/\1/'` + + EMULATOR_STATE="${HA_RSCTMP}/VirtualDomain-${DOMAIN_NAME}-emu.state" + } +diff --git a/heartbeat/WAS b/heartbeat/WAS +index 15b56e99..44aa83e2 100755 +--- a/heartbeat/WAS ++++ b/heartbeat/WAS +@@ -227,7 +227,7 @@ WASPortInfo() { + esac + PortCount=`expr $PortCount + 1` + done +- netstat -ltnp 2>/dev/null| egrep -i "($pat) .*LISTEN" | sed 's%.*LISTEN *%%' ++ netstat -ltnp 2>/dev/null| $EGREP -i "($pat) .*LISTEN" | sed 's%.*LISTEN *%%' + } + + # +diff --git a/heartbeat/WAS6 b/heartbeat/WAS6 +index 9e18cd68..e71eec93 100755 +--- a/heartbeat/WAS6 ++++ b/heartbeat/WAS6 +@@ -196,7 +196,7 @@ WASPortInfo() { + esac + PortCount=`expr $PortCount + 1` + done +- netstat -ltnp 2>/dev/null| egrep -i "($pat) .*LISTEN" | sed 's%.*LISTEN *%%' ++ netstat -ltnp 2>/dev/null| $EGREP -i "($pat) .*LISTEN" | sed 's%.*LISTEN *%%' + } + + # +diff --git a/heartbeat/docker b/heartbeat/docker +index 50523db9..d51c4689 100755 +--- a/heartbeat/docker ++++ b/heartbeat/docker +@@ -512,7 +512,7 @@ image_exists() + # - image + # - repository:port/image + # - docker.io/image (some distro will display "docker.io/" as prefix) +- docker images | awk '{print $1 ":" $2}' | egrep -q -s "^(docker.io\/|${SERVER_NAME}\/)?${IMAGE_NAME}:${IMAGE_TAG}\$" ++ docker images | awk '{print $1 ":" $2}' | $EGREP -q -s "^(docker.io\/|${SERVER_NAME}\/)?${IMAGE_NAME}:${IMAGE_TAG}\$" + if [ $? -eq 0 ]; then + # image found + return 0 +diff --git a/heartbeat/eDir88.in b/heartbeat/eDir88.in +index cd945d2c..9a21ff85 100644 +--- a/heartbeat/eDir88.in ++++ b/heartbeat/eDir88.in +@@ -331,7 +331,7 @@ eDir_monitor() { + + # Monitor IDM first, as it will start before LDAP + if [ $MONITOR_IDM -eq 1 ]; then +- RET=$($NDSTRACE --config-file "$NDSCONF" -c modules | egrep -i '^vrdim.*Running' | awk '{print $1}') ++ RET=$($NDSTRACE --config-file "$NDSCONF" -c modules | $EGREP -i '^vrdim.*Running' | awk '{print $1}') + if [ "$RET" != "vrdim" ]; then + ocf_log err "eDirectory IDM engine isn't running ($NDSCONF)." + return $OCF_ERR_GENERIC +diff --git a/heartbeat/mysql-proxy b/heartbeat/mysql-proxy +index 013c5e4e..2815860d 100755 +--- a/heartbeat/mysql-proxy ++++ b/heartbeat/mysql-proxy +@@ -572,7 +572,7 @@ mysqlproxy_validate_all() + fi + + # check for valid log-level +- echo $log_level | egrep -q "^(error|warning|info|message|debug|)$" ++ echo $log_level | $EGREP -q "^(error|warning|info|message|debug|)$" + if [ $? -ne 0 ]; then + ocf_log err "MySQL Proxy log level '$log_level' not in valid range error|warning|info|message|debug" + return $OCF_ERR_CONFIGURED +diff --git a/heartbeat/portblock b/heartbeat/portblock +index e88ecc2a..450e3720 100755 +--- a/heartbeat/portblock ++++ b/heartbeat/portblock +@@ -529,7 +529,7 @@ IptablesStop() + CheckPort() { + # Examples of valid port: "1080", "1", "0080" + # Examples of invalid port: "1080bad", "0", "0000", "" +- echo $1 |egrep -qx '[0-9]+(:[0-9]+)?(,[0-9]+(:[0-9]+)?)*' ++ echo $1 | $EGREP -qx '[0-9]+(:[0-9]+)?(,[0-9]+(:[0-9]+)?)*' + } + + IptablesValidateAll() +diff --git a/heartbeat/rabbitmq-server-ha b/heartbeat/rabbitmq-server-ha +index 8b3cd9ee..f4833803 100755 +--- a/heartbeat/rabbitmq-server-ha ++++ b/heartbeat/rabbitmq-server-ha +@@ -529,7 +529,7 @@ proc_stop() + pid="none" + else + # check if provide just a number +- echo "${pid_param}" | egrep -q '^[0-9]+$' ++ echo "${pid_param}" | $EGREP -q '^[0-9]+$' + if [ $? -eq 0 ]; then + pid="${pid_param}" + elif [ -e "${pid_param}" ]; then # check if passed in a pid file +diff --git a/heartbeat/sapdb.sh b/heartbeat/sapdb.sh +index 66e9854b..dccd36e1 100755 +--- a/heartbeat/sapdb.sh ++++ b/heartbeat/sapdb.sh +@@ -238,7 +238,7 @@ sapdatabase_monitor() { + esac + + SEARCH=`echo "$OCF_RESKEY_MONITOR_SERVICES" | sed 's/\+/\\\+/g' | sed 's/\./\\\./g'` +- if [ `echo "$SERVICE" | egrep -c "$SEARCH"` -eq 1 ] ++ if [ `echo "$SERVICE" | $EGREP -c "$SEARCH"` -eq 1 ] + then + if [ $STATE -eq $OCF_NOT_RUNNING ] + then +diff --git a/heartbeat/smb-share.in b/heartbeat/smb-share.in +index 8a1a0a86..3e5bf60b 100755 +--- a/heartbeat/smb-share.in ++++ b/heartbeat/smb-share.in +@@ -435,7 +435,7 @@ smb_share_stop() { + smb_share_monitor() { + RES=$(smbcontrol smbd ping > /dev/null 2>&1) + if [ $? -eq 0 ];then +- if [ $(testparm -s 2>/dev/null| egrep -c \\[$OCF_RESKEY_share\\]) -eq 1 ];then ++ if [ $(testparm -s 2>/dev/null| $EGREP -c \\[$OCF_RESKEY_share\\]) -eq 1 ];then + return $OCF_SUCCESS + else + return $OCF_NOT_RUNNING +@@ -449,7 +449,7 @@ smb_share_state() { + smb_share_checktmpmount + RES=$(smbcontrol smbd ping > /dev/null 2>&1) + if [ $? -eq 0 ];then +- if [ $(testparm -s 2>/dev/null| egrep -c \\[$OCF_RESKEY_share\\]) -eq 1 ];then ++ if [ $(testparm -s 2>/dev/null| $EGREP -c \\[$OCF_RESKEY_share\\]) -eq 1 ];then + ocf_log info "Samba share $OCF_RESKEY_share is active" + return $OCF_SUCCESS + else +diff --git a/heartbeat/symlink b/heartbeat/symlink +index decd9f74..82a667a0 100755 +--- a/heartbeat/symlink ++++ b/heartbeat/symlink +@@ -123,7 +123,7 @@ symlink_monitor() { + ocf_log debug "$OCF_RESKEY_link exists but is not a symbolic link, will be moved to ${OCF_RESKEY_link}${OCF_RESKEY_backup_suffix} on start" + rc=$OCF_NOT_RUNNING + fi +- elif readlink -m "$OCF_RESKEY_link" | egrep -q "^$(readlink -m ${OCF_RESKEY_target})$"; then ++ elif readlink -m "$OCF_RESKEY_link" | $EGREP -q "^$(readlink -m ${OCF_RESKEY_target})$"; then + ocf_log debug "$OCF_RESKEY_link exists and is a symbolic link to ${OCF_RESKEY_target}." + rc=$OCF_SUCCESS + else +-- +2.25.1 + diff --git a/backport-Fix-shellcheck-errors-on-output-redirection-SC2328.patch b/backport-Fix-shellcheck-errors-on-output-redirection-SC2328.patch new file mode 100644 index 0000000..cb7f149 --- /dev/null +++ b/backport-Fix-shellcheck-errors-on-output-redirection-SC2328.patch @@ -0,0 +1,192 @@ +From 1ae01063230849a087fb2aad0118a88bbdfd00f2 Mon Sep 17 00:00:00 2001 +From: Valentin Vidic +Date: Sun, 24 Aug 2025 17:11:48 +0200 +Subject: [PATCH] Fix shellcheck errors on output redirection [SC2328] + +heartbeat/smb-share:436:36: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/smb-share:450:36: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/jira:78:95: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/jira:149:95: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/proftpd:145:51: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/minio:126:77: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/iface-bridge:681:27: error: This redirection takes output away from the command substitution (use tee to duplicate). [SC2328] +heartbeat/iface-bridge:697:29: error: This redirection takes output away from the command substitution (use tee to duplicate). [SC2328] +heartbeat/iface-bridge:713:28: error: This redirection takes output away from the command substitution (use tee to duplicate). [SC2328] +heartbeat/iface-bridge:726:27: error: This redirection takes output away from the command substitution (use tee to duplicate). [SC2328] +heartbeat/kamailio:480:126: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/kamailio:483:126: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/kamailio:486:128: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/kamailio:489:132: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/kamailio:493:124: error: This redirection takes output away from the command substitution. [SC2328] +heartbeat/ZFS:93:41: error: This redirection takes output away from the command substitution. [SC2328] +--- + heartbeat/ZFS | 5 +++-- + heartbeat/iface-bridge | 8 ++++---- + heartbeat/jira.in | 4 ++-- + heartbeat/kamailio.in | 10 +++++----- + heartbeat/minio | 2 +- + heartbeat/proftpd | 2 +- + heartbeat/smb-share.in | 4 ++-- + 7 files changed, 18 insertions(+), 17 deletions(-) + +diff --git a/heartbeat/ZFS b/heartbeat/ZFS +index 560c1b5c..e9404d48 100755 +--- a/heartbeat/ZFS ++++ b/heartbeat/ZFS +@@ -87,10 +87,11 @@ zpool_is_imported () { + if [ -d /proc/spl/kstat/zfs/ ] ; then + # Check the existence of kstats for the pool. If the stats exists, the pool was imported. + [ -d /proc/spl/kstat/zfs/"${OCF_RESKEY_pool}" ] +- rc=$? ++ rc=$? + else + # If ZFS kstats do not exists, fallback to the standard check +- rc=$(zpool list -H "$OCF_RESKEY_pool" > /dev/null) ++ zpool list -H "$OCF_RESKEY_pool" > /dev/null ++ rc=$? + fi + return $rc + } +diff --git a/heartbeat/iface-bridge b/heartbeat/iface-bridge +index a4e50adb..3ac79f1b 100755 +--- a/heartbeat/iface-bridge ++++ b/heartbeat/iface-bridge +@@ -678,7 +678,7 @@ bridge_start() { + mcrouter=0 + fi + if [ -e "/sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_router" ]; then +- error="$(echo $mcrouter > /sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_router 2>&1)" ++ error="$(echo $mcrouter 2>&1 >/sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_router)" + if [ "$?" != "0" ]; then + ocf_log err "Unable to set OCF_RESKEY_multicast_router for bridge $OCF_RESKEY_bridge_name: $error" + return $OCF_ERR_GENERIC +@@ -694,7 +694,7 @@ bridge_start() { + mcsnooping=0 + fi + if [ -e "/sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_snooping" ]; then +- error="$(echo $mcsnooping > /sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_snooping 2>&1)" ++ error="$(echo $mcsnooping 2>&1 >/sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_snooping)" + if [ "$?" != "0" ]; then + ocf_log err "Unable to set OCF_RESKEY_multicast_snooping for bridge $OCF_RESKEY_bridge_name: $error" + return $OCF_ERR_GENERIC +@@ -710,7 +710,7 @@ bridge_start() { + mcquerier=0 + fi + if [ -e "/sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_querier" ]; then +- error="$(echo $mcquerier > /sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_querier 2>&1)" ++ error="$(echo $mcquerier 2>&1 >/sys/class/net/$OCF_RESKEY_bridge_name/bridge/multicast_querier)" + if [ "$?" != "0" ]; then + ocf_log err "Unable to set OCF_RESKEY_multicast_querier for bridge $OCF_RESKEY_bridge_name: $error" + return $OCF_ERR_GENERIC +@@ -723,7 +723,7 @@ bridge_start() { + if [ -n "$OCF_RESKEY_multicast_port_router" ]; then + split_string $OCF_RESKEY_multicast_port_router | { while read iface mcport; do + if [ -e "/sys/class/net/$iface/brport/multicast_router" ]; then +- error="$(echo $mcport > /sys/class/net/$iface/brport/multicast_router 2>&1)" ++ error="$(echo $mcport 2>&1 >/sys/class/net/$iface/brport/multicast_router)" + if [ "$?" != "0" ]; then + ocf_log err "Unable to set OCF_RESKEY_multicast_port_router $mcport for interface $iface on bridge $OCF_RESKEY_bridge_name : $error" + return $OCF_ERR_GENERIC +diff --git a/heartbeat/jira.in b/heartbeat/jira.in +index 66a8e53f..6094ea18 100644 +--- a/heartbeat/jira.in ++++ b/heartbeat/jira.in +@@ -75,7 +75,7 @@ jira_start() { + waittime=300 + su -m $jira_user -c "$jira_installation/bin/startup.sh &> /dev/null" + while [[ $waittime -gt 0 ]]; do +- if $(curl --connect-timeout 1 --max-time 3 -s ${statusurl} | grep '{"state":"RUNNING"}' > /dev/null); then ++ if curl --connect-timeout 1 --max-time 3 -s ${statusurl} | grep '{"state":"RUNNING"}' > /dev/null; then + waittime=0 + else + sleep 1 +@@ -146,7 +146,7 @@ jira_monitor() { + + if $(kill -0 $(cat ${jira_installation}/work/catalina.pid 2> /dev/null) 2> /dev/null) ; then + # Is jira working +- if $(curl --connect-timeout 1 --max-time 3 -s ${statusurl} | grep '{"state":"RUNNING"}' > /dev/null) ; then ++ if curl --connect-timeout 1 --max-time 3 -s ${statusurl} | grep '{"state":"RUNNING"}' > /dev/null; then + rc=0 + else + # Jira has a problem +diff --git a/heartbeat/kamailio.in b/heartbeat/kamailio.in +index 4f6af3db..54a97513 100644 +--- a/heartbeat/kamailio.in ++++ b/heartbeat/kamailio.in +@@ -477,20 +477,20 @@ kamailio_status() { + + errorfile=`mktemp` + case ${OCF_RESKEY_proto} in +- udp) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport udp>/dev/null 2>>$errorfile` ++ udp) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport udp 2>>$errorfile` + result=$? + ;; +- tcp) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport tcp>/dev/null 2>>$errorfile` ++ tcp) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport tcp 2>>$errorfile` + result=$? + ;; +- udptcp) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport tcp>/dev/null 2>>$errorfile` ++ udptcp) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport tcp 2>>$errorfile` + result=$? + if [ $result -eq 0 ]; then +- output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport udp>/dev/null 2>>$errorfile` ++ output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport udp 2>>$errorfile` + result=$? + fi + ;; +- *) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport udp>/dev/null 2>>$errorfile` ++ *) output=`$OCF_RESKEY_sipsak -s sip:monitor@$OCF_RESKEY_monitoring_ip:${OCF_RESKEY_port} -H localhost --transport udp 2>>$errorfile` + result=$? + ;; + esac +diff --git a/heartbeat/minio b/heartbeat/minio +index 16ceeed4..8f3b85f1 100755 +--- a/heartbeat/minio ++++ b/heartbeat/minio +@@ -123,7 +123,7 @@ minio_status() + # Minio is probably running + PID=`head -n 1 $OCF_RESKEY_pidfile` + if [ ! -z "$PID" ] ; then +- isRunning "$PID" && `ps -p $PID | grep minio-server > /dev/null 2>&1` ++ isRunning "$PID" && ps -p $PID | grep minio-server > /dev/null 2>&1 + return $? + fi + fi +diff --git a/heartbeat/proftpd b/heartbeat/proftpd +index a9fc5ffd..0bd36050 100755 +--- a/heartbeat/proftpd ++++ b/heartbeat/proftpd +@@ -142,7 +142,7 @@ proftpd_status() + # Proftpd is probably running + PID=`head -n 1 $OCF_RESKEY_pidfile` + if [ ! -z "$PID" ] ; then +- isRunning "$PID" && `ps -p $PID | grep proftpd > /dev/null 2>&1` ++ isRunning "$PID" && ps -p $PID | grep proftpd > /dev/null 2>&1 + return $? + fi + fi +diff --git a/heartbeat/smb-share.in b/heartbeat/smb-share.in +index 3e5bf60b..94f573f7 100755 +--- a/heartbeat/smb-share.in ++++ b/heartbeat/smb-share.in +@@ -433,7 +433,7 @@ smb_share_stop() { + } + + smb_share_monitor() { +- RES=$(smbcontrol smbd ping > /dev/null 2>&1) ++ smbcontrol smbd ping > /dev/null 2>&1 + if [ $? -eq 0 ];then + if [ $(testparm -s 2>/dev/null| $EGREP -c \\[$OCF_RESKEY_share\\]) -eq 1 ];then + return $OCF_SUCCESS +@@ -447,7 +447,7 @@ smb_share_monitor() { + + smb_share_state() { + smb_share_checktmpmount +- RES=$(smbcontrol smbd ping > /dev/null 2>&1) ++ smbcontrol smbd ping > /dev/null 2>&1 + if [ $? -eq 0 ];then + if [ $(testparm -s 2>/dev/null| $EGREP -c \\[$OCF_RESKEY_share\\]) -eq 1 ];then + ocf_log info "Samba share $OCF_RESKEY_share is active" +-- +2.25.1 + diff --git a/resource-agents.spec b/resource-agents.spec index 54e8284..d18a545 100644 --- a/resource-agents.spec +++ b/resource-agents.spec @@ -1,7 +1,7 @@ Name: resource-agents Summary: Open Source HA Reusable Cluster Resource Scripts Version: 4.16.0 -Release: 10 +Release: 11 License: GPLv2+ and LGPLv2+ URL: https://github.com/ClusterLabs/resource-agents Source0: https://github.com/ClusterLabs/resource-agents/releases/tag/v%{version}.tar.gz @@ -23,6 +23,8 @@ Patch0014: backport-ocf-shellfuncs-set-SHELL-to-default-shell-if-it-s- Patch0015: backport-ocf-shellfuncs-remove-extra-sleep-from-curl_retry-20.patch Patch0016: backport-db2-add-skip_basic_sql_health_check-parameter-to-avo.patch Patch0017: backport-db2-add-monitor_retries-monitor_sleep-and-monitor_re.patch +Patch0018: backport-All-agents-use-detected-grep-E-F-instead-of-egrep-fg.patch +Patch0019: backport-Fix-shellcheck-errors-on-output-redirection-SC2328.patch Obsoletes: heartbeat-resources <= %{version} Provides: heartbeat-resources = %{version} @@ -121,6 +123,10 @@ export CFLAGS="$(echo '%{optflags}')" %{_mandir}/man8/{ocf-tester.8*,ldirectord.8*} %changelog +* Thu Oct 30 2025 bizhiyuan - 4.16.0-11 +- Fix shellcheck errors on output redirection [SC2328] +- All agents: use detected grep -E/-F instead of egrep/fgrep + * Wed Oct 29 2025 bizhiyuan - 4.16.0-10 - db2: add "monitor_retries", "monitor_sleep", and"monitor_retry_all_errors" parameters to be able to avoid failing on firsttry - db2: add "skip_basic_sql_health_check" parameter to avoidfailing on systems with high load -- Gitee