Bug 724972

Summary: gpg-agent does not support utf-8
Product: [Fedora] Fedora Reporter: Stanislav Ochotnicky <sochotni>
Component: pinentryAssignee: Stanislav Ochotnicky <sochotni>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: axel.thimm, dueno, i18n-bugs, rdieter, sochotni, syeghiay, tagoh, tmraz, tomasz.kepczynski, tomek
Target Milestone: ---Keywords: i18n, Patch, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 704495 Environment:
Last Closed: 2015-02-18 13:35:42 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:
Bug Depends On: 1030926    
Bug Blocks:    
Attachments:
Description Flags
Patch fixing the bug none

Description Stanislav Ochotnicky 2011-07-22 13:17:50 UTC
+++ This bug was initially created as a clone of Bug #704495 +++

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.

--- Additional comment from tmraz on 2011-05-13 14:17:14 CEST ---

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?


--- Additional comment from tomasz.kepczynski on 2011-05-13 18:51:08 CEST ---

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?

--- Additional comment from tmraz on 2011-05-16 07:45:22 CEST ---

What terminal do you use?

--- Additional comment from tomek on 2011-05-16 20:35:54 CEST ---

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)

--- Additional comment from tomek on 2011-05-16 20:41:06 CEST ---

I take back local konsole part - in this case dialog box is displayed and my name is displayed correctly.

--- Additional comment from tmraz on 2011-05-16 21:14:21 CEST ---

The terminal output is handled by pinentry.

--- Additional comment from tomek on 2011-05-17 10:17:11 CEST ---

Created attachment 499280 [details]
pinentry-curses garbled output

--- Additional comment from tomek on 2011-05-17 10:18:55 CEST ---

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.


--- Additional comment from sochotni on 2011-07-18 11:10:30 CEST ---

The bug can be reproduced in also in RHEL 6. Thank you for the bugreport.

Comment 1 Stanislav Ochotnicky 2011-07-22 13:21:17 UTC
Created attachment 514695 [details]
Patch fixing the bug

I have prepared a relatively simple patch that solves the problem accoring to my testing. It consists of 2 things:
 1. link against libncursesw
 2. call setlocale(LC_CTYPE, "") before initialising ncurses

I sent the patch upstream for comments

Comment 2 Rex Dieter 2011-07-22 13:51:15 UTC
thanks.  

For posterity, how did you contact upstream?  via bug tracker? mailing list?  in particular, can you include a reference to that contact here?

Comment 3 Stanislav Ochotnicky 2011-07-22 14:29:06 UTC
Sure, forgot to add it to my previous comment:
http://lists.gnupg.org/pipermail/gpa-dev/2011-July/002513.html

Comment 4 Daiki Ueno 2011-09-05 03:03:13 UTC
FYI, another fix has been committed in upstream:

http://git.gnupg.org/cgi-bin/gitweb.cgi?p=pinentry.git;a=commit;h=e2b89cbd

Comment 5 Akira TAGOH 2012-02-29 08:41:15 UTC
Any chance to backport it? that may be worth considering if the upstream release cycle is too long...

Comment 6 Rex Dieter 2012-02-29 14:38:38 UTC
Sure, just need to carve out some time to work on it.

Comment 7 Daiki Ueno 2012-08-13 01:29:46 UTC
New upstream version with the fix has been released last week:
http://lists.gnupg.org/pipermail/gnupg-users/2012-August/045186.html

Comment 8 Fedora End Of Life 2013-04-03 19:42:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19

Comment 9 Fedora Admin XMLRPC Client 2014-07-19 17:59:51 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 10 Fedora End Of Life 2015-01-09 21:51:05 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Fedora End Of Life 2015-02-18 13:35:42 UTC
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.