Error handling in libassuan
Open, NormalPublic

Description

When I connect gpg-agent running with LANG=ja_JP, when an error, it can be like this with longer error message:

$ gpg-connect-agent "SCD getattr KEY-STATUS" /bye
ERR 100663364 オブジェクト内に項目が欠如してい\343 <SCD>

It's "Missing item in object" but Japanese translation text is 18 character long, 54 in bytes in UTF-8, it is truncated in the middle of character, resulted \343.
The message is truncated in libassuan/src/assuan-handler.c (in the function assuan_process_done), formatting with %.50s, thus, it is truncated at the middle of character in the UTF-8 representation.

There are two problems here:
(1) How the error message is truncated
(2) It would be good if an error message is generated at the client side (not server side), and it is client side which does the translation, if needed.

Related Objects

gniibe created this task.Thu, Sep 3, 4:45 AM
gniibe updated the task description. (Show Details)
werner added a subscriber: werner.Thu, Sep 3, 9:55 AM

re 1: Correct utf-8 truncation would be quite some work. In this case the message is in the Assuan interface is a debugging aid. Translation is not necessary so we can try to disable it.

re 2: Given that it is a debugging aid, I don't think that extra code in the cleint is justified

To implement this it would be best to have an gpg_strerror variant which does not call dgettext.