Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

pinentry ignores backspace #40335

Closed
proski opened this issue Jun 3, 2015 · 10 comments
Closed

pinentry ignores backspace #40335

proski opened this issue Jun 3, 2015 · 10 comments

Comments

@proski
Copy link

proski commented Jun 3, 2015

pinentry (the curses version) ignores backspace. The backspace key sends code 0x7f both in iTerm and in Terminal.app. Ctrl-H works, but it's not intuitive. Users may have trouble fixing errors in the password.

@jacknagel
Copy link
Contributor

Sounds like something that should be reported to the pinentry authors rather than Homebrew?

@chdiza
Copy link
Contributor

chdiza commented Jun 6, 2015

Is this problem still occurring in the newly-released pinentry 0.9.4?

0.9.3 was full of little problems, if the gnupg-dev mailing list is any indication.

@jacknagel
Copy link
Contributor

This still happens on 0.9.4.

@chdiza
Copy link
Contributor

chdiza commented Jun 16, 2015

I can confirm. Has anyone reported it upstream?

As another data point, I noticed there is no backspace problem with their newly-included pinentry-tty.

(Homebrew doesn't enable that in the formula; unconnected with the present issue, I'm thinking about making a PR to add it).

@chdiza
Copy link
Contributor

chdiza commented Jun 16, 2015

Well this is weird. I can confirm the bug also on the curses mode of pinentry-mac, which has embedded pinentry 0.8.1. I have a hard time believing that backspacing is broken on pinentry on OSX since that far back. I could swear I've used it myself within the last couple of years. Perhaps Yosemite broke something.

@chdiza
Copy link
Contributor

chdiza commented Jun 18, 2015

Ping.

If nobody has reported it yet, I will, but I don't want to issue a duplicate report.

@MikeMcQuaid
Copy link
Member

@chdiza That'd be great, thanks!

@chdiza
Copy link
Contributor

chdiza commented Jun 20, 2015

Done.

@chdiza
Copy link
Contributor

chdiza commented Jun 23, 2015

OK, after lots of pain, this has been fixed in upstream's git repo. It is not yet in a release. I also asked if they'd cut a release quickly to help out OSX users.

Turns out, backspace (what's labeled "delete" on Mac keyboarads near their northeast corners) has NEVER worked in pinentry on OSX.

In the meantime, you can just use Ctrl-h instead of backspace/delete.

Maintainers: we can also (untested but should work) apply the patch, and then remove it at next release. Shall I make a PR now, or wait to see if they cut a release tomorrow? EDIT: I'll just make a PR.

diff --git a/pinentry/pinentry-curses.c b/pinentry/pinentry-curses.c
index 235435a..784c770 100644
--- a/pinentry/pinentry-curses.c
+++ b/pinentry/pinentry-curses.c
@@ -705,7 +705,11 @@ dialog_input (dialog_t diag, int alt, int chr)
   switch (chr)
     {
     case KEY_BACKSPACE:
-    case 'h' - 'a' + 1: /* control-h.  */
+      /* control-h.  */
+    case 'h' - 'a' + 1:
+      /* ASCII DEL.  What Mac OS X apparently emits when the "delete"
+    (backspace) key is pressed.  */
+    case 127:
       if (diag->pin_len > 0)
    {
      diag->pin_len--;

Also, be aware that when the next release lands we're going to have to add another --disable-FOO flag. That's because there is forthcoming some kind of "emacs" version of pinentry, and at least right now, their HEAD won't build on OSX without disabling it. I'll take care of all this when the release lands.

@proski
Copy link
Author

proski commented Jun 23, 2015

Thank you for fixing that bug! I confirm that Delete on the native keyboard and Backspace on an external USB keyboard erase the preceding character. To compile pinentry, I checked it out from git://git.gnupg.org/pinentry.git I had to use brew link --force gettext before autogen.sh as suggested somewhere on StackExchange to avoid unexpanded macros. For whatever reason, I cannot post comments on the GnuPG bugtracker, so please feel free to repost my gratitude and my test results there :)

@DomT4 DomT4 closed this as completed in d4a26d2 Jun 24, 2015
@Homebrew Homebrew locked and limited conversation to collaborators Jul 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants