"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Thomas Adam <thomas@xteddy.org>
Subject:
regress: sh portability fixes
To:
gameoftrees@openbsd.org
Date:
Fri, 3 Mar 2023 16:29:16 +0000

Download raw body.

Thread
Hi all,

I've noticed a few '[ $foo == $bar ]' constructs creeping in, where they
should be '[ $foo = $bar ]' on POSIX-shells, especially (d)ash, where I run
most of those tests.

Can someone give me an OK to commit, if/when happy?

Thanks!

Kindly,
Thomas
diff /tmp/got
commit - f55db25a40103e9990a713a4f61d37686d786194
path + /tmp/got
blob - 88a6dc75585a2d1b900d0d9d747bfb9a2540b8cb
file + regress/cmdline/backout.sh
--- regress/cmdline/backout.sh
+++ regress/cmdline/backout.sh
@@ -289,7 +289,7 @@ test_backout_logmsg_ref() {
 
 	for r in $wt_sorted; do
 		echo $sep >> $testroot/stdout.expected
-		if [ $r == $branch_rev ]; then
+		if [ $r = $branch_rev ]; then
 			echo "backout $r" >> $testroot/stdout.expected
 			echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
 			echo "date: $date" >> $testroot/stdout.expected
@@ -399,7 +399,7 @@ test_backout_logmsg_ref() {
 	echo -n > $testroot/stdout.expected
 	for r in $wt2_sorted; do
 		echo $sep >> $testroot/stdout.expected
-		if [ $r == $branch2_rev ]; then
+		if [ $r = $branch2_rev ]; then
 			echo "backout $r" >> $testroot/stdout.expected
 			echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
 			echo "date: $date" >> $testroot/stdout.expected
@@ -437,7 +437,7 @@ test_backout_logmsg_ref() {
 
 	for r in $wt_sorted; do
 		echo -n "backout $r" >> $testroot/wt.list
-		if [ $r == $branch_rev2 ]; then
+		if [ $r = $branch_rev2 ]; then
 			echo -n " (newbranch)" >> $testroot/wt.list
 		fi
 		echo >> $testroot/wt.list
@@ -446,14 +446,14 @@ test_backout_logmsg_ref() {
 
 	for r in $wt2_sorted; do
 		echo -n "backout $r" >> $testroot/wt2.list
-		if [ $r == $branch2_rev2 ]; then
+		if [ $r = $branch2_rev2 ]; then
 			echo -n " (newbranch2)" >> $testroot/wt2.list
 		fi
 		echo >> $testroot/wt2.list
 		echo "work tree: $wt2_uuid" >> $testroot/wt2.list
 	done
 
-	if [ $wt_uuid == $wt_first ]; then
+	if [ $wt_uuid = $wt_first ]; then
 		mv $testroot/wt.list $testroot/stdout.expected
 		cat $testroot/wt2.list >> $testroot/stdout.expected
 	else
blob - 5f8f09cafb0426ef5bc92fae1bf7d909c80282ad
file + regress/cmdline/cherrypick.sh
--- regress/cmdline/cherrypick.sh
+++ regress/cmdline/cherrypick.sh
@@ -1773,7 +1773,7 @@ test_cherrypick_logmsg_ref() {
 
 	for r in $wt_sorted; do
 		echo $sep >> $testroot/stdout.expected
-		if [ $r == $branch_rev ]; then
+		if [ $r = $branch_rev ]; then
 			echo "cherrypick $r" >> $testroot/stdout.expected
 			echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
 			echo "date: $date" >> $testroot/stdout.expected
@@ -1883,7 +1883,7 @@ test_cherrypick_logmsg_ref() {
 	echo -n > $testroot/stdout.expected
 	for r in $wt2_sorted; do
 		echo $sep >> $testroot/stdout.expected
-		if [ $r == $branch2_rev ]; then
+		if [ $r = $branch2_rev ]; then
 			echo "cherrypick $r" >> $testroot/stdout.expected
 			echo "from: $GOT_AUTHOR" >> $testroot/stdout.expected
 			echo "date: $date" >> $testroot/stdout.expected
@@ -1921,7 +1921,7 @@ test_cherrypick_logmsg_ref() {
 
 	for r in $wt_sorted; do
 		echo -n "cherrypick $r" >> $testroot/wt.list
-		if [ $r == $branch_rev2 ]; then
+		if [ $r = $branch_rev2 ]; then
 			echo -n " (newbranch)" >> $testroot/wt.list
 		fi
 		echo >> $testroot/wt.list
@@ -1930,14 +1930,14 @@ test_cherrypick_logmsg_ref() {
 
 	for r in $wt2_sorted; do
 		echo -n "cherrypick $r" >> $testroot/wt2.list
-		if [ $r == $branch2_rev2 ]; then
+		if [ $r = $branch2_rev2 ]; then
 			echo -n " (newbranch2)" >> $testroot/wt2.list
 		fi
 		echo >> $testroot/wt2.list
 		echo "work tree: $wt2_uuid" >> $testroot/wt2.list
 	done
 
-	if [ $wt_uuid == $wt_first ]; then
+	if [ $wt_uuid = $wt_first ]; then
 		mv $testroot/wt.list $testroot/stdout.expected
 		cat $testroot/wt2.list >> $testroot/stdout.expected
 	else
blob - 5abd887aa45862efaed44d7fe13cdbf897e90883
file + regress/cmdline/commit.sh
--- regress/cmdline/commit.sh
+++ regress/cmdline/commit.sh
@@ -1871,7 +1871,7 @@ EOF
 	local first=`printf '%s\n%s' $branch_rev $branch_rev2 | sort | head -1`
 	local second=`printf '%s\n%s' $branch_rev $branch_rev2 | sort | tail -1`
 
-	if [ $branch_rev == $first ]; then
+	if [ $branch_rev = $first ]; then
 		local first_msg=$branch_rev_logmsg
 		local second_msg=$branch_rev2_logmsg
 	else