From: Eric Biggers Date: Tue, 19 Nov 2019 22:31:28 +0000 Subject: [RFC PATCH 1/3] common/rc: handle option with argument in _require_xfs_io_command() Message-Id: <20191119223130.228341-2-ebiggers@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20191119223130.228341-1-ebiggers@kernel.org> In-Reply-To: <20191119223130.228341-1-ebiggers@kernel.org> To: fstests@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, keyrings@vger.kernel.org, Jarkko Sakkinen From: Eric Biggers Fix _require_xfs_io_command() to handle options that take arguments when the argument is shown in the help text. E.g., it didn't work to run: _require_xfs_io_command "add_enckey" "-k" because the relevant line of the help text is: -k KEY_ID -- ID of fscrypt-provisioning key containing the raw key ... but the grep command only matched "-k --", not "-k KEY_ID --". Signed-off-by: Eric Biggers --- common/rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/rc b/common/rc index b988e912..8d9479c0 100644 --- a/common/rc +++ b/common/rc @@ -2216,7 +2216,7 @@ _require_xfs_io_command() [ -n "$param" ] || return if [ -z "$param_checked" ]; then - $XFS_IO_PROG -c "help $command" | grep -q "^ $param --" || \ + $XFS_IO_PROG -c "help $command" | grep -E -q "^ $param ([a-zA-Z_]+ )?--" || \ _notrun "xfs_io $command doesn't support $param" else # xfs_io could result in "command %c not supported" if it was -- 2.24.0.432.g9d3f5f5b63-goog