[pass] Output from pass generate should go to stderr

Lie Ryan ryan.lie at gecogaming.com
Mon Sep 14 10:22:25 CEST 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Reattaching the diff file as the mailing list software seems to have
scrubbed it out.

diff --git a/src/password-store.sh b/src/password-store.sh
index d535a74..143695f 100755
- --- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -467,10 +467,12 @@ cmd_generate() {
        fi
        local verb="Add"
        [[ $inplace -eq 1 ]] && verb="Replace"
- -       git_add_file "$passfile" "$verb generated password for ${path}."
+       git_add_file "$passfile" "$verb generated password for ${path}." >&2
 
        if [[ $clip -eq 0 ]]; then
- -               printf "\e[1m\e[37mThe generated password for
\e[4m%s\e[24m is:\e[0m\n\e[1m\e[93m%s\e[0m\n" "$path" "$pass"
+               printf "\e[1m\e[37mThe generated password for
\e[4m%s\e[24m is:\e[0m\n\e[1m\e[93m%s\e[0m" "$path" >&2
+               printf "$pass"
+               printf "\n" >&2
        else
                clip "$pass" "$path"
        fi


On 14/09/15 18:06, Lie Ryan wrote:
> Currently, the output of `pass generate` cannot be piped into another > command that expects a password because it contains git output and
other > interactive outputs. For example: > >     openssl genpkey
-algorithm RSA -pkeyopt rsa_keygen_bits:2048 > -aes-256-cbc -pass
file:<(pass example.com.key 30 2>/dev/null) -out > example.com.key > >
Fails because pass outputs the git commit messages into the named pipe >
passed to -pass. > > The attachment is rudimentary attempt to send most
output from generate > to stderr except the password itself. > > Maybe a
better implementation is to have an explicit --quiet option?

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQIcBAEBAgAGBQJV9oO/AAoJENvRQiuLY26n5RgP/10bIKcpT8FeiHz+LGurItwE
vbJa0DJLi50f4ZgH/LDo2jIHNG8TYzoJZ7LireHK3SbwQAcei3HTIBT7m5gi+/z7
mvsz9k7pXfKn35TN7/FL2ClbKRciZQjqJqtP4wl9V/hUHkzxxGSCohjqzIVX+/6u
Ub1GacZ/b9rUk7KBfzMB0A/4FU+EYV8hHdGjAqIgvLJlVTU05x8W8WNPHXh7+vP4
Goj10bgiFcW1CBpxcVAy3ijfv8tEH04+rv3pvGtAHJ6rIzntev2QTr2xs+chT1HK
CD9EbtstLUvUxMZRI6kxFKCjkx29U4IYvkYjSLNlW9mQYilCc4jQzANuHfPB56mY
+9dsFApHdJdq+/fBAtKA5F3dmM0U4Zka/+oYs0/wSK/eW8pY3/CGY7Rw53lnESC0
2RPejcJop9dpDJnnkpzv4wUzAfnaCvLgb3yLS8fqKzk4dATx/mmpD0ULU9jISK8l
HrWaz7NAMA2xEe3VSIwwFkemskTQwlDgRTxeEleiAGtZF+jhC8HiJLGoR9xWbwqv
NgwQho4fWJipvCaRfPJjQOEOlQ27Mz75GYZbeARy6+A0+Wqo8oKZ6tDiOne6S1Zn
qHDOrcu48koYDFDjzUADB4aigz5dTAG4EAWkbJhYta7XWrcbhjqQQtOvE8hpaZSy
S9Yiz60iO9HoZg6DJVUR
=6cvv
-----END PGP SIGNATURE-----



More information about the Password-Store mailing list