[pass] pass grep doesn't spawn pinentry dialog when no cached password is available in gpg-agent

Lucas Hoffmann l-m-h at web.de
Fri Nov 28 10:26:32 CET 2014


On Fri, Nov 28, 2014 at 09:43:50AM +0700, Allan Odgaard wrote:
> The issue is with stdin (not stdout), so it’s not the pipe connecting $GPG
> to grep but rather the pipe that connects “read” used in the loop with find.
>
> This is the loop in question:
>
> 	while read -r -d "" passfile; do
>> 	done < <(find -L "$PREFIX" -iname '*.gpg' -print0)
>
> Everything inside this loop is disconnected from the tty because stdin has
> been redirected to a pipe.
>
> It’s a non-trival loop body, otherwise I would have said to just rewrite it
> using xargs.

I agree that the loop body is a little complicated (I also send a patch
some time ago but there was no reaction yet).  I have attached a patch
that will make stdin available in the loops in reencrypt_path and
grep_cmd which both use the `while read ... done < <(find ...)`
construct at the moment.

This patch introduces a new helper function that is used to populate a
bash array with the relevant files (the output of the find command) and
exposes it to the caller.  The two functions reencrypt_path and grep_cmd
can use this function to replace the while loop with a for loop and
thereby make stdin available inside the loop.

Please try it and let me know if it can solve your problem.

Cheers
Lucas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glob.patch
Type: text/x-diff
Size: 1921 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20141128/a3c83a44/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.zx2c4.com/pipermail/password-store/attachments/20141128/a3c83a44/attachment.asc>


More information about the Password-Store mailing list