[PATCH] replace 'which' with POSIX equivalent 'command -v'

Ayush Agarwal ayush at fastmail.in
Sun Sep 19 09:59:21 UTC 2021


Hi Amir,

> what motivated you to make this change? Did your try to run pass in an environment without `which`, or did `which` exit with an erroneous success status for you?

Nah, nothing of the sort. I was just going through the source code of password-store and thought that using `which` was unnecessary and can be replaced with `command -v` without making any significant changes. I'm also in the process of writing my own password store extensions and scripts as a learning experience so sending a patch here was part of the process as well.

Ayush

----- Original message -----
From: Amir Yalon <quoiceehoh-20180826 at yxejamir.net>
To: Ayush Agarwal <ayush at fastmail.in>, password-store at lists.zx2c4.com
Subject: Re: [PATCH] replace 'which' with POSIX equivalent 'command -v'
Date: Sunday, September 19, 2021 2:21 PM

I am in favour of incorporating this patch, LGTM.

Just curious: what motivated you to make this change? Did your try to run pass in an environment without `which`, or did `which` exit with an erroneous success status for you?

On Wed, 15 Sep 2021, at 20:17, Ayush Agarwal wrote:
> The 'which' command is an external command that must be called each and
> every time pass is used. 'which' is also not mentioned in the README as
> one of the dependencies that might be needed to run pass.
> 
> Instead of 'which', we can use the POSIX compatible and shell built-in
> 'command -v'. It saves pass from making an external call and is,
> arguably, more reliable than using 'which' as mentioned in the following
> link.
> 
> <https://mywiki.wooledge.org/BashFAQ/081>


More information about the Password-Store mailing list