From: Andreas Schneider Date: Tue, 5 Aug 2025 09:11:10 +0000 (+0200) Subject: s3:tests: Fix shellcheck warning of test_wbinfo_lookuprids_cache.sh X-Git-Tag: tdb-1.4.14~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=df35b106c8da2ce563301bd9f41fea0817a91996;p=thirdparty%2Fsamba.git s3:tests: Fix shellcheck warning of test_wbinfo_lookuprids_cache.sh In source3/script/tests/test_wbinfo_lookuprids_cache.sh line 27: key=$("$TDBDUMP" "$cache" | grep ^key.*NDR.*/"$opnum"/ | cut -d\" -f2) ^-------------------^ SC2062 (warning): Quote the grep pattern so the shell won't interpret it. Lets better use awk for matching the pattern. Signed-off-by: Andreas Schneider Reviewed-by: Volker Lendecke --- diff --git a/source3/script/tests/test_wbinfo_lookuprids_cache.sh b/source3/script/tests/test_wbinfo_lookuprids_cache.sh index fef4e04b369..2f441d21af3 100755 --- a/source3/script/tests/test_wbinfo_lookuprids_cache.sh +++ b/source3/script/tests/test_wbinfo_lookuprids_cache.sh @@ -24,7 +24,7 @@ testit "flush" "$NET" "cache" "flush" || failed=$(expr $failed + 1) testit "lookuprids1" "$WBINFO" "-R" "512,12345" || failed=$(expr $failed + 1) opnum=$($PYTHON -c'from samba.dcerpc.winbind import wbint_LookupRids; print(wbint_LookupRids.opnum())') -key=$("$TDBDUMP" "$cache" | grep ^key.*NDR.*/"$opnum"/ | cut -d\" -f2) +key=$("$TDBDUMP" "$cache" | awk -F'"' -v opnum="${opnum}" '/key.*NDR/ { regex = "NDR/[^/]+/" opnum "/.*$"; if (match($2, regex)) print substr($2, RSTART, RLENGTH) }') testit "delete" "$TDBTOOL" "$cache" delete "$key" testit "lookuprids2" "$WBINFO" "-R" "512,12345" || failed=$(expr $failed + 1)