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

ಚಿರಾಗ್ ನಟರಾಜ್ chiraag.nataraj at gmail.com
Sun May 19 16:16:19 CEST 2019


Hmm, I see. I thought best practice was to store command line arguments as an array?

Anyway, can't really change that haha. I'll read it in using `read -a` as you (and shellcheck) suggest.

- Chiraag
-- 
ಚಿರಾಗ್ ನಟರಾಜ್
Graduate Student at Brown University
Email: chiraag.nataraj at gmail.com
Phone: 610-350-6329
Website: http://chiraag.nataraj.us

On 18/05/19 17:22, Oliver Albertini wrote:
> >
> > 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 --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20190519/f7ad79a1/attachment.asc>


More information about the Password-Store mailing list