Bug 704495

Summary: gpg-agent does not support utf-8
Product: Red Hat Enterprise Linux 6 Reporter: Tomasz Kepczynski <tomek>
Component: pinentryAssignee: Boris Ranto <branto>
Status: CLOSED ERRATA QA Contact: Martin Žember <mzember>
Severity: unspecified Docs Contact:
Priority: high    
Version: 6.0CC: branto, ebenes, ksrot, mzember, ovasik, syeghiay, tmraz, tomasz.kepczynski
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: pinentry-0.7.6-8.el6 Doc Type: Bug Fix
Doc Text:
Cause: The pinentry-curses binary lacked UTF-8 support in some places. Consequence: The output of description text in pinentry getpin command got scrambled. Fix: Do a proper utf-8 translation and compile pinentry against ncursesw that contains the wide char support necessary to fix this. Result: The description field in getpin command is outputted correctly.
Story Points: ---
Clone Of:
: 724972 (view as bug list) Environment:
Last Closed: 2015-03-30 08:09:22 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
garbled output from gpg when asking for password
none
pinentry-curses garbled output none

Description Tomasz Kepczynski 2011-05-13 12:05:52 UTC
Created attachment 498757 [details]
garbled output from gpg when asking for password

Description of problem:
gnupg2 requires usage of agent to retrieve key passphrase. Console version of this agent doesn't seem to support UTF-8 properly - see the attached screenshot.

Version-Release number of selected component (if applicable):
gnupg2-2.0.14-4.el6.i686

How reproducible:
always

Steps to Reproduce:
Use gpg on a key which contains non-ascii characters in its name.
 
Actual results:
The output is garbled

Expected results:
The output is clean.

Additional info:
Detected on ScientificLinux 6 but I guess this is also a case on RHEL.

Comment 1 Tomas Mraz 2011-05-13 12:17:14 UTC
I do not think this is a bug in the gnupg2. I suppose there is non-utf8 locale set in the gnupg2 agent environment.

Can you call 'unset GPG_AGENT_INFO' before runing the gpg2 command and test it again?

Comment 3 Tomasz Kepczynski 2011-05-13 16:51:08 UTC
I don't think this is a reason:

triss:~> set | grep GPG
triss:~>

But to make sure I am not missing anything, I tried:

triss:~> unset GPG_AGENT_INFO
triss:~> gpg -d ~/pliki/txt/dane.txt.asc

with exactly the same problem as in the screenshot.

And locale for completness:

triss:~> locale
LANG=pl_PL.UTF-8
LC_CTYPE="pl_PL.UTF-8"
LC_NUMERIC="pl_PL.UTF-8"
LC_TIME="pl_PL.UTF-8"
LC_COLLATE="pl_PL.UTF-8"
LC_MONETARY="pl_PL.UTF-8"
LC_MESSAGES="pl_PL.UTF-8"
LC_PAPER="pl_PL.UTF-8"
LC_NAME="pl_PL.UTF-8"
LC_ADDRESS="pl_PL.UTF-8"
LC_TELEPHONE="pl_PL.UTF-8"
LC_MEASUREMENT="pl_PL.UTF-8"
LC_IDENTIFICATION="pl_PL.UTF-8"
LC_ALL=

Now, the problem looks very similar to fault in finger, which also garbled UTF-8 output, this was caused by outputting a string byte by byte with putc instead pushing whole string at once to terminal. Maybe this is the case?

Comment 4 Tomas Mraz 2011-05-16 05:45:22 UTC
What terminal do you use?

Comment 5 Tomasz Kepczynski 2011-05-16 18:35:54 UTC
I can reproduce this on:
- local text console (linux)
- remote linux console (text console + ssh connection)
- local konsole (kde konsole)
- remote konsole (kde konsole + ssh)

konsole identifies itself as xterm (TERM=xterm)

Comment 6 Tomasz Kepczynski 2011-05-16 18:41:06 UTC
I take back local konsole part - in this case dialog box is displayed and my name is displayed correctly.

Comment 7 Tomas Mraz 2011-05-16 19:14:21 UTC
The terminal output is handled by pinentry.

Comment 8 Tomasz Kepczynski 2011-05-17 08:17:11 UTC
Created attachment 499280 [details]
pinentry-curses garbled output

Comment 9 Tomasz Kepczynski 2011-05-17 08:18:55 UTC
I tried the following in pinentry-curses:

gklab-63-001:~> pinentry-curses
OK Your orders please
option lc-ctype=pl_PL.UTF-8
OK
setdesc ąćęłńóśźżĄĆĘŁŃÓŚŹŻ
OK
getpin

which resulted in the attached above screen. This seems to confirm that a problem is in pinentry.

Comment 10 RHEL Program Management 2011-07-06 01:32:35 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 13 Stanislav Ochotnicky 2011-07-18 09:10:30 UTC
The bug can be reproduced in also in RHEL 6. Thank you for the bugreport.

Comment 16 Stanislav Ochotnicky 2012-07-04 11:48:32 UTC
For the record, upstream fixed this[1]. Have yet to look at possible backporting.

[1] http://git.gnupg.org/cgi-bin/gitweb.cgi?p=pinentry.git;a=commitdiff;h=e2b89cbdcba7475047ca3c46fc7d03825355b3ff

Comment 23 Boris Ranto 2015-02-26 11:30:08 UTC
*** Bug 1191639 has been marked as a duplicate of this bug. ***

Comment 27 Boris Ranto 2015-02-26 21:00:15 UTC
dist-git commits related to build pinentry-0.7.6-8.el6:
http://pkgs.devel.redhat.com/cgit/rpms/pinentry/commit/?h=rhel-6.7&id=311a4d55bd96fffe1efe898c81afce986f0bcac1

Comment 36 errata-xmlrpc 2015-03-30 08:09:22 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-0755.html