[LTP] [PATCH] network/nfs_lib.sh: Use double quotes for grep pattern

Petr Vorel pvorel@suse.cz
Mon Jun 8 16:58:31 CEST 2020


Hi Xiao,

Reviewed-by: Petr Vorel <petr.vorel@gmail.com>

> +++ b/testcases/network/nfs/nfs_stress/nfs_lib.sh
> @@ -58,7 +58,7 @@ nfs_server_udp_enabled()
>  	tst_rhost_run -c "[ -f /etc/nfs.conf ]" || return 0
>  	config=$(tst_rhost_run -c 'for f in $(grep ^include.*= '/etc/nfs.conf' | cut -d = -f2); do [ -f $f ] && printf "$f "; done')

> -	tst_rhost_run -c "grep -q '^[# ]*udp *= *y' /etc/nfs.conf $config"
> +	tst_rhost_run -c "grep -q \"^[# ]*udp *= *y\" /etc/nfs.conf $config"
Good catch. But I wonder if we shouldn't fix tst_rhost_run instead, to avoid
this error in the future. How about replacing ' with \" in $cmd?

Kind regards,
Petr


More information about the ltp mailing list