Skip to contentSkip to conversation

common: handle old versions of modprobe which don't support --help

PATCH New Theodore Ts'o 1 participant 1 message Feb 3, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common: handle old versions of modprobe which don't support --help

There exists versions of modprobe out there which are so old that modprobe --help isn't a thing. They're certainly not going to support modprobe --remove-patiently, so test to make sure modprobe --help works to avoid causing all tests failing due to the error message from modprobe showing up in $seq.out.

Fixes 405c21d40aa1 ("common/module: add patient module rmmod support")
---
 common/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
common/config +1 -1
index be741c6b..cac528e8 100644
@@ -256,7 +256,7 @@ export UDEV_SETTLE_PROG
 # Set MODPROBE_PATIENT_RM_TIMEOUT_SECONDS to "forever" if you want the patient
 # modprobe removal to run forever trying to remove a module.
 MODPROBE_REMOVE_PATIENT=""
-modprobe --help | grep -q -1 "remove-patiently"
+modprobe --help >& /dev/null && modprobe --help | grep -q -1 "remove-patiently"
 if [[ $? -ne 0 ]]; then
 	if [[ -z "$MODPROBE_PATIENT_RM_TIMEOUT_SECONDS" ]]; then
 		# We will open code our own implementation of patient module
Signature · 1 line
2.31.0