[dbscripts,v2,1/8] test: common.bash:__getCheckSum: Don't rely on IFS

Message ID 20180218171736.4473-2-lukeshu@lukeshu.com
State Superseded
Headers show
Series PKGEXT fixup | expand

Commit Message

Luke Shumaker Feb. 18, 2018, 5:17 p.m. UTC
From: Luke Shumaker <lukeshu@parabola.nu>

I managed to stumble across a bug in BATS where the run() function screwed
with the global IFS.  This breaks __getCheckSum().  The bug has been fixed
in git, but isn't in a release yet; go ahead and work around it.  The code
getting more robust isn't a bad thing!

https://github.com/sstephenson/bats/issues/89
---
 test/lib/common.bash | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Patch

diff --git a/test/lib/common.bash b/test/lib/common.bash
index 540e403..cad4e13 100644
--- a/test/lib/common.bash
+++ b/test/lib/common.bash
@@ -9,8 +9,9 @@  __updatePKGBUILD() {
 }
 
 __getCheckSum() {
-	local result=($(sha1sum $1))
-	echo ${result[0]}
+	local result
+	result="$(sha1sum "$1")"
+	echo "${result%% *}"
 }
 
 __buildPackage() {