From 08d36340756f4b337981889ad4468f62edf61810 Mon Sep 17 00:00:00 2001 From: Cody Boone Ferguson <53008573+xexyl@users.noreply.github.com> Date: Wed, 4 Oct 2023 05:38:48 -0700 Subject: [PATCH] Fix regexp in ioccc_status.sh - add boundaries It served no good without the '^' and '$' as that would mean that as long as the format is in the string anything else could be in front or after (or in between if format specified more than once). --- tmp/src/ioccc_status/ioccc_status.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tmp/src/ioccc_status/ioccc_status.sh b/tmp/src/ioccc_status/ioccc_status.sh index 2dfd3ebdd..5af8ff9c0 100755 --- a/tmp/src/ioccc_status/ioccc_status.sh +++ b/tmp/src/ioccc_status/ioccc_status.sh @@ -41,7 +41,7 @@ USAGE="usage: $(basename "$0") [-h] [-V] [-v level] [-s status] [-d] [-n] [-i st -n update latest_news date -i status_ver update IOCCC_status_version - NOTE: version must match the regexp: [0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2} + NOTE: version must match the regexp: ^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$ status.json the file to update @@ -132,9 +132,9 @@ fi # check format of IOCCC_status_version if set (-i used, $UPDATE_IOCCC_STATUS_VERSION) if [[ -n "$UPDATE_IOCCC_STATUS_VERSION" ]]; then - echo "$IOCCC_STATUS_VERSION" | grep -qE '[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}' + echo "$IOCCC_STATUS_VERSION" | grep -qE '^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$' if [[ "${PIPESTATUS[1]}" -ne 0 ]]; then - echo "$0: ERROR: IOCCC_status_version must match the regexp: '[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}'" 1>&2 + echo "$0: ERROR: IOCCC_status_version must match the regexp: '^[0-9]+\.[0-9]+ [0-9]{4}-[0-9]{2}-[0-9]{2}$'" 1>&2 exit 3 fi fi