diff mbox series

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

Message ID 20220201231936.981003-1-tytso@mit.edu (mailing list archive)
State New, archived
Headers show
Series common: handle old versions of modprobe which don't support --help | expand

Commit Message

Theodore Ts'o Feb. 1, 2022, 11:19 p.m. UTC
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 suppress a spurious warning.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Fixes: 405c21d40aa1 ("common/module: add patient module rmmod support")
Reported-by: Leah Rumancik <leah.rumancik@gmail.com>
Cc: Luis Chamberlain <mcgrof@kernel.org>
---
 common/config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Luis Chamberlain Feb. 2, 2022, 2:47 a.m. UTC | #1
On Tue, Feb 01, 2022 at 06:19:36PM -0500, Theodore Ts'o wrote:
> 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 suppress a spurious warning.

Wow.

> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Fixes: 405c21d40aa1 ("common/module: add patient module rmmod support")
> Reported-by: Leah Rumancik <leah.rumancik@gmail.com>
> Cc: Luis Chamberlain <mcgrof@kernel.org>

Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

  Luis
Theodore Ts'o Feb. 2, 2022, 1:48 p.m. UTC | #2
On Tue, Feb 01, 2022 at 06:19:36PM -0500, Theodore Ts'o wrote:
> 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 suppress a spurious warning.

I was going to reword the last part of the commit message, but forgot
to do it before sending out the message.

- works to suppress a spurious warning.
+ works to avoid causing all tests to fail due to the error message
+ to stderr showing up in $seq.out.

	     	    	       	  - Ted
diff mbox series

Patch

diff --git a/common/config b/common/config
index be741c6b..cac528e8 100644
--- a/common/config
+++ b/common/config
@@ -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