On 02/22/2018 03:43 PM, Luke Shumaker wrote:
> From: Luke Shumaker <luke...@parabola.nu>
> 
> I managed to stumble across a bug in BATS where the run() function
> screwed with the global IFS.  The bug has been fixed in git, but isn't
> in a release yet.
> 
> https://github.com/sstephenson/bats/issues/89
> 
> Anyway, this bug breaks __getCheckSum().  Fortunately, we have avoided
> tripping it so far because luck has it that we never call
> __getCheckSum() after run() in the same test.
> 
> So, there's nothing actually broken here, but it makes me nervous.  So
> go ahead and modify __getCheckSum to not rely on IFS.
> ---
>  test/lib/common.bash | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/test/lib/common.bash b/test/lib/common.bash
> index 568a541..5411641 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%% *}"

Why are you moving over to declaring the variable and assigning it on
different lines?

-- 
Eli Schwartz
Bug Wrangler and Trusted User

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to