From 8a045edc52155f50d5daf38def42079fdc42d72c Mon Sep 17 00:00:00 2001 From: Coiby Xu Date: Thu, 9 Oct 2025 16:52:06 +0800 Subject: [PATCH] Fix SC2181 issues in kdump-udev-throttler Resolves: https://issues.redhat.com/browse/RHEL-104940 Conflict: .github/workflows/main.yml only exists upstream commit e25009be073adcf00885d42c5ae3856b49ce7188 Author: Coiby Xu Date: Wed Jul 23 13:32:42 2025 +0800 Fix SC2181 issues in kdump-udev-throttler Fix the issues found by shellcheck, In kdump-udev-throttler line 30: if [ $? -ne 0 ]; then ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. In kdump-udev-throttler line 37: if [ $? -ne 0 ]; then ^-- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. Also add kdump-udev-throttler to shellcheck list for Github Action. Signed-off-by: Coiby Xu Signed-off-by: Coiby Xu --- kdump-udev-throttler | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kdump-udev-throttler b/kdump-udev-throttler index 208599e..5d3a6d4 100755 --- a/kdump-udev-throttler +++ b/kdump-udev-throttler @@ -26,15 +26,14 @@ unuse_luks_keys() [[ -f $LUKS_CONFIGFS_REUSE ]] || echo 0 > $LUKS_CONFIGFS_REUSE } -exec 9> $throttle_lock -if [ $? -ne 0 ]; then + +if ! exec 9> $throttle_lock; then echo "Failed to create the lock file! Fallback to non-throttled kdump service restart" /bin/kdumpctl reload exit 1 fi -flock -n 9 -if [ $? -ne 0 ]; then +if ! flock -n 9; then echo "Throttling kdump restart for concurrent udev event" exit 0 fi