[PATCH] pass generates quite a few errors/warnings with shellcheck

Oliver Albertini oliver.ruben at gmail.com
Sun May 19 02:22:38 CEST 2019


>
> I'm surprised that shellcheck didn't complain about lines 26, 58, 73,
> 96, 98, 141 (of the patch, don't know its correspondences with the code).


Most of those are inside `[[` tests, so they don't require quoting (word
splitting doesn't happen inside `[[`). The other case is a for loop, which
shellcheck doesn't warn about (in fact if you quote it, it will give
you warning
SC2066 <https://github.com/koalaman/shellcheck/wiki/SC2066>). It assumes
you will rely on word splitting to get a list of args.

Chiraag, I'm a bit confused why the switch to using array notation for
`$PASSWORD_STORE_GPG_OPTS`. That's not going to be an array, but just a
string that can be set in the environment. Also, the quoting would pass the
users opts as one string, instead of separate strings to `gpg`. Consider
this example:

$ var="-n foo"
$ echo $var
foo$ echo "$var"
-n foo

We either want to not quote, or use something like `mapfile` or `read -a`
to put the opts into an array. I hesitate to use `mapfile` since that
wasn't around in bash 3, which is what ships in macOS these days (many are
using bash 5 now!). But `read -a` is a good alternative.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190518/e7156aac/attachment.html>


More information about the Password-Store mailing list