From: James Nunez Date: Sat, 12 Sep 2020 18:04:02 +0000 (-0600) Subject: LU-13960 tests: correct usage of _var variable X-Git-Tag: 2.13.56~17 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=ff29ed8fe9c58bd2caa4d63bcbe7556e1c320703 LU-13960 tests: correct usage of _var variable In the setmodopts() function in functions.sh, the '_var' variable is set and used. There is one use of the variable 'var' which should be '_var'. Change the use of 'var' to '_var'. Test-Parameters: trivial Test-Parameters: testlist=conf-sanity env=ONLY=53 clientdistro=ubuntu2004 fstype=ldiskfs Test-Parameters: testlist=conf-sanity env=ONLY=53 clientdistro=ubuntu1804 fstype=ldiskfs Test-Parameters: testlist=conf-sanity env=ONLY=53 clientdistro=el7.8 fstype=ldiskfs Signed-off-by: James Nunez Change-Id: If524be1f0b4b2170a514a558256a5308c9a5e586 Reviewed-on: https://review.whamcloud.com/39891 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: John L. Hammond Reviewed-by: Vikentsi Lapa --- diff --git a/lustre/tests/functions.sh b/lustre/tests/functions.sh index 8d010df..9a27e27 100644 --- a/lustre/tests/functions.sh +++ b/lustre/tests/functions.sh @@ -126,35 +126,35 @@ $msg" # # In the second usage the new value is appended to the old. setmodopts() { - local _append=false + local _append=false - if [ "$1" = -a ]; then - _append=true - shift - fi + if [ "$1" = -a ]; then + _append=true + shift + fi - local _var=MODOPTS_$1 - local _newvalue=$2 - local _savevar=$3 - local _oldvalue + local _var=MODOPTS_$1 + local _newvalue=$2 + local _savevar=$3 + local _oldvalue - # Dynamic naming of variables is a pain in bash. In ksh93 we could - # write "nameref opts_var=${modname}_MODOPTS" then assign directly - # to opts_var. Associative arrays would also help, alternatively. - # Alas, we're stuck with eval until all distros move to a more recent - # version of bash. Fortunately we don't need to eval unset and export. + # Dynamic naming of variables is a pain in bash. In ksh93 we could + # write "nameref opts_var=${modname}_MODOPTS" then assign directly + # to opts_var. Associative arrays would also help, alternatively. + # Alas, we're stuck with eval until all distros move to a more recent + # version of bash. Fortunately we don't need to eval unset and export. - if [ -z "$_newvalue" ]; then - unset $_var - return 0 - fi + if [ -z "$_newvalue" ]; then + unset $_var + return 0 + fi - _oldvalue=${!var} - $_append && _newvalue="$_oldvalue $_newvalue" - export $_var="$_newvalue" - echo setmodopts: ${_var}=${_newvalue} + _oldvalue=${!_var} + $_append && _newvalue="$_oldvalue $_newvalue" + export $_var="$_newvalue" + echo setmodopts: ${_var}=${_newvalue} - [ -n "$_savevar" ] && eval $_savevar=\""$_oldvalue"\" + [ -n "$_savevar" ] && eval $_savevar=\""$_oldvalue"\" } echoerr () { echo "$@" 1>&2 ; }