[arch-projects] [dbscripts] [PATCH 1/3] test: common.bash:__getCheckSum: Don't rely on IFS

Luke Shumaker lukeshu at lukeshu.com
Fri Feb 23 01:54:10 UTC 2018


On Thu, 22 Feb 2018 19:27:04 -0500,
Eli Schwartz wrote:
> 
> [1 Re: [arch-projects] [dbscripts] [PATCH 1/3] test: common.bash:__getCheckSum: Don't rely on IFS <multipart/mixed (7bit)>]
> [1.1  <text/plain; utf-8 (quoted-printable)>]
> On 02/22/2018 06:43 PM, Luke Shumaker wrote:
> > On Thu, 22 Feb 2018 16:43:36 -0500,
> > Eli Schwartz wrote:
> >>>  __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?
> > 
> > Because shellcheck complains about it, so it's a habit I've gotten in
> > to :) Even in cases where it doesn't really make a difference.
> > 
> > https://github.com/koalaman/shellcheck/wiki/SC2155
> > 
> > However, BATS does run the test suite with `set -e`, so splitting it
> > does mean that BATS will now detect errors from sha1sum.  We don't
> > really expect that to happen, but if BATS will give us error checking
> > on it for free, why not?
> 
> Then the commit message should say so...

Honestly, I didn't even think about it.  Like I said, I've just made
it a habit.

-- 
Happy hacking,
~ Luke Shumaker


More information about the arch-projects mailing list