From 7a5a03ef8504e2b3faf1f34a8d38d3e6e0dfa18a Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 8 Apr 2024 20:05:29 -0500
Subject: use a specific version number in test scripts

This avoids issue reported in #1041 with file glob confusing cd.
Also remove extra newline from VERSION when update.sh runs.
---
 scripts/test | 9 +++++----
 update.sh    | 2 +-
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/scripts/test b/scripts/test
index 97e316e..6d9c15c 100755
--- a/scripts/test
+++ b/scripts/test
@@ -4,6 +4,7 @@ set -x
 
 unset CC
 ENABLE_ASM="${ENABLE_ASM:=ON}"
+VERSION=`cat VERSION`
 
 if type apt-get >/dev/null 2>&1; then
 	sudo apt-get update
@@ -26,8 +27,8 @@ if [ `uname` = "Darwin" ]; then
 	make -j 4 distcheck
 
 	# test cmake
-	tar zxvf libressl-*.tar.gz
-	cd libressl-*
+	tar zxvf libressl-$VERSION.tar.gz
+	cd libressl-$VERSION
 
 	(
 		mkdir build-static
@@ -57,8 +58,8 @@ elif [ "$ARCH" = "native" ]; then
 	# make distribution
 	make -j 4 distcheck
 
-	tar zxvf libressl-*.tar.gz
-	cd libressl-*
+	tar zxvf libressl-$VERSION.tar.gz
+	cd libressl-$VERSION
 
 
 	# test cmake and ninja
diff --git a/update.sh b/update.sh
index f7c48ee..9540a76 100755
--- a/update.sh
+++ b/update.sh
@@ -151,7 +151,7 @@ else
 	$CP $libcrypto_src/opensslv.h include/openssl
 fi
 
-awk '/LIBRESSL_VERSION_TEXT/ {print $4}' < include/openssl/opensslv.h | cut -d\" -f1 > VERSION
+awk '/LIBRESSL_VERSION_TEXT/ {print $4}' < include/openssl/opensslv.h | cut -d\" -f1 | head -n1 > VERSION
 echo "LibreSSL version `cat VERSION`"
 
 # copy libcrypto source
-- 
cgit v1.2.3-55-g6feb