On Fri, Mar 22, 2024 at 04:46:39PM +0530, Anand Jain wrote: > The -v and -o short options in btrfs-corrupt-block were introduced and > replaced with the long options --value and --offset in the same > btrfs-progs release 5.19 by the following commits: > > b2ada0594116 ("btrfs-progs: corrupt-block: corrupt generic item data") > 22ffee3c6cf2 ("btrfs-progs: corrupt-block: use only long options for value and offset") > > We hope that if these commits are backported, they are both backported at > the same time. > > Use only the long options of btrfs-corrupt-block in the test cases. Also, > check if btrfs-corrupt-block has the options --value and --offset. > > Signed-off-by: Anand Jain <anand.jain@xxxxxxxxxx> > --- > common/btrfs | 15 +++++++++++++++ > 1 file changed, 15 insertions(+) > > diff --git a/common/btrfs b/common/btrfs > index ae13fb55cbc6..a8340fdd4748 100644 > --- a/common/btrfs > +++ b/common/btrfs > @@ -659,7 +659,22 @@ _btrfs_buffered_read_on_mirror() > > _require_btrfs_corrupt_block() > { > + # An optional arg1 argument to also check the option. > + local opt=$1 > + local ret > + > _require_command "$BTRFS_CORRUPT_BLOCK_PROG" btrfs-corrupt-block > + > + if [ -z "$opt" ]; then > + return > + fi > + > + $BTRFS_CORRUPT_BLOCK_PROG -h 2>&1 | grep -q -- " --$opt " I'm wondering if we can use the "-w" option to replace the two blanks around the --$opt (due to I don't know if there always be two blanks), likes: grep -qw -- "--$opt" ? > + ret=$? > + > + if [ $ret != 0 ]; then The "ret" looks like useless at here. If there's not other place uses this return value, we can use "$?" directly. If no objection from you, I can help to change that when I merge. Others looks good to me. Reviewed-by: Zorro Lang <zlang@xxxxxxxxxx> > + _notrun "Require $BTRFS_CORRUPT_BLOCK_PROG option --$opt" > + fi > } > > _require_btrfs_send_version() > -- > 2.39.3 > >