Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spurious "gpg-agent might not work" message #1

Closed
istathar opened this issue Oct 26, 2012 · 4 comments
Closed

Spurious "gpg-agent might not work" message #1

istathar opened this issue Oct 26, 2012 · 4 comments
Labels

Comments

@istathar
Copy link

When starting up, you get an error message in red reverse video saying "gpg-agent might not work." and then ... it works. This is especially evident when you edit a new empty file with a .asc suffix; the message holds on the status line.

AfC

@jamessan
Copy link
Owner

As indicated in gpg-agent(1),

You should always add the following lines to your .bashrc or whatever initialization file is used for all shell invocations:

GPG_TTY=$(tty)
export GPG_TTY

It is important that this environment variable always reflects the output of the tty command. For W32 systems this option is not required.

While it may work without that, it may not. I can change the message from an "error" to a "warning" though, since it's not a black & white matter.

@istathar
Copy link
Author

Ok. In this case (thank god for progress) the gpg agent in question is launched when logging into a GNOME desktop. I would like to think that the thing has been properly initialized; certainly popup dialogs for passphrases occur on the correct $DISPLAY. So all in all this seems like an under-the-hood detail that should just be taken care of by gdm or gpg or both. Regardless, sure, I can set the variable in .bash_profile, but yes, a warning would seem better. Especially since absolutely no one is going to have that variable set by default seeing as how most of us are using our login manager's desktop environment.

AfC

@jamessan
Copy link
Owner

Ah, there's actually a bug here. There's code to automatically set GPG_TTY if it isn't set, but the way it is written will never work correctly.

I'll fix that, change the highlighting to a warning, and combine the two warning messages into one so that you see more than just "gpg-agent might not work." in this specific situation.

jamessan added a commit that referenced this issue Oct 29, 2012
It's possible that gpg will work fine without $GPG_TTY being set (e.g., when
using a GUI pinentry program).  Therefore, the message should be classified as
a warning, not an error.

Also, use a single :echom to ensure the user sees the entire message, not just
"gpg-agent might not work."

First part of GH #1

Signed-off-by: James McCoy <vega.james@gmail.com>
jamessan added a commit that referenced this issue Oct 29, 2012
Using system('tty') will always report "not a tty", since the spawned shell
has stdin redirected.  In order to get an accurate value for $GPG_TTY when
it's not already set, read the output of the tty command using :!.

This requires a bit more setup/teardown to ensure the buffer and user's undo
state aren't affected, but it's the only way to accurately determine the
user's tty.

Closes: #1
Signed-off-by: James McCoy <vega.james@gmail.com>
@istathar
Copy link
Author

istathar commented Nov 2, 2012

Very nicely done. Just tested it, works much more cleanly.

Time to blog about this :)

AfC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants