]> arthur.barton.de Git - bup.git/commitdiff
test-rm: ensure entire string matches in wv_matches_rx
authorRob Browning <rlb@defaultvalue.org>
Sat, 21 Oct 2017 16:14:55 +0000 (11:14 -0500)
committerRob Browning <rlb@defaultvalue.org>
Sat, 21 Oct 2017 16:35:08 +0000 (11:35 -0500)
Previously trailing garbage (for example) would have been ignored.

Signed-off-by: Rob Browning <rlb@defaultvalue.org>
Tested-by: Rob Browning <rlb@defaultvalue.org>
t/test-rm.sh

index e0c9b5307da380dfc3684665c654a4aa480ffb74..0887a9d1ad88a99a5a2b68bc99019d51282c44b2 100755 (executable)
@@ -27,7 +27,7 @@ wv_matches_rx()
     echo "$str" | sed 's/^\(.*\)/  \1/' 1>&2 || exit $?
     echo "Against:" 1>&2 || exit $?
     echo "$rx" | sed 's/^\(.*\)/  \1/' 1>&2 || exit $?
-    if [[ "$str" =~ $rx ]]; then
+    if [[ "$str" =~ ^${rx}$ ]]; then
         echo "! $src regex matches ok" 1>&2 || exit $?
     else
         echo "! $src regex doesn't match FAILED" 1>&2 || exit $?