Skip to content

Commit 29206ac

Browse files
committed
fix(rust): use ERE-compatible regex in start_release.sh version check
The version check used the PCRE escape \d in an egrep pattern: REGEX_VERSION='^\d+\.\d+\.\d+$' MATCHES=$(echo "$1" | egrep $REGEX_VERSION | wc -l) egrep uses POSIX Extended Regular Expressions, which do not support \d. The pattern therefore matched nothing, every input was treated as invalid, and the script always exited with: Version "X.Y.Z" must be N.N.N This caused the 'Run start_release.sh and open a release PR' job to fail with exit code 1 even though VERSION=1.3.0 had already passed the workflow's own pre-check (which uses bash regex ^[0-9]+\.[0-9]+\.[0-9]+$). Replace \d with [0-9] so the regex actually matches N.N.N, and quote the variable expansion in egrep for safety.
1 parent 4567535 commit 29206ac

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

DynamoDbEncryption/runtimes/rust/start_release.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,11 @@ fi
99
# Go to the directory of this script
1010
cd $( dirname ${BASH_SOURCE[0]} )
1111

12-
# Check if the provided argument matches the version pattern
13-
REGEX_VERSION='^\d+\.\d+\.\d+$'
14-
MATCHES=$(echo "$1" | egrep $REGEX_VERSION | wc -l)
12+
# Check if the provided argument matches the version pattern.
13+
# Note: egrep uses POSIX ERE, which does not support PCRE escapes like \d.
14+
# Use [0-9] instead so the regex actually matches N.N.N versions.
15+
REGEX_VERSION='^[0-9]+\.[0-9]+\.[0-9]+$'
16+
MATCHES=$(echo "$1" | egrep "$REGEX_VERSION" | wc -l)
1517
if [ $MATCHES -eq 0 ]; then
1618
echo 1>&2 "Version \"$1\" must be N.N.N"
1719
exit 1

0 commit comments

Comments
 (0)