[pacman-dev] [PATCH 1/2] signing: modify question text with unknwon uid
From: Christian Hesse <mail@eworm.de> If the key's uid is unknown (for example with db signatures) the question was: :: Import PGP key 02FD1C7A934E614545849F19A6234074498E9CEE, "(null)"? [Y/n] Let's display a modified question for unknwon uid. Signed-off-by: Christian Hesse <mail@eworm.de> --- src/pacman/callback.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 25528100..3e67c1d8 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -456,8 +456,14 @@ void cb_question(alpm_question_t *question) case ALPM_QUESTION_IMPORT_KEY: { alpm_question_import_key_t *q = &question->import_key; - q->import = yesno(_("Import PGP key %s, \"%s\"?"), - q->key->fingerprint, q->key->uid); + /* the uid is unknwon with db signatures */ + if (q->key->uid == NULL) { + q->import = yesno(_("Import PGP key %s with unknown uid?"), + q->key->fingerprint); + } else { + q->import = yesno(_("Import PGP key %s, \"%s\"?"), + q->key->fingerprint, q->key->uid); + } } break; }
From: Christian Hesse <mail@eworm.de> With unknown uid pacman crashed. Return with error from email_from_uid() if uid is NULL. Signed-off-by: Christian Hesse <mail@eworm.de> --- lib/libalpm/signing.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index f9569ac5..30d057a3 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -478,6 +478,11 @@ static int email_from_uid(const char *uid, char **email) { char *start, *end; + if (uid == NULL) { + email = NULL; + return -1; + } + start = strrchr(uid, '<'); if(start) { end = strrchr(start, '>');
On 7/10/19 11:35 pm, Christian Hesse wrote:
From: Christian Hesse <mail@eworm.de>
If the key's uid is unknown (for example with db signatures) the question was:
:: Import PGP key 02FD1C7A934E614545849F19A6234074498E9CEE, "(null)"? [Y/n]
Let's display a modified question for unknwon uid.
Typo
Signed-off-by: Christian Hesse <mail@eworm.de> --- src/pacman/callback.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 25528100..3e67c1d8 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -456,8 +456,14 @@ void cb_question(alpm_question_t *question) case ALPM_QUESTION_IMPORT_KEY: { alpm_question_import_key_t *q = &question->import_key; - q->import = yesno(_("Import PGP key %s, \"%s\"?"), - q->key->fingerprint, q->key->uid); + /* the uid is unknwon with db signatures */
Typo
+ if (q->key->uid == NULL) { + q->import = yesno(_("Import PGP key %s with unknown uid?"),
This is not a great question. I had a fair idea what you were doing, and I still thought "what is a uid?". Other options: Import PGP key %s from unknown source? Import PGP key %s?
+ q->key->fingerprint); + } else { + q->import = yesno(_("Import PGP key %s, \"%s\"?"), + q->key->fingerprint, q->key->uid); + } } break; } .
Allan McRae <allan@archlinux.org> on Mon, 2019/10/07 23:44:
On 7/10/19 11:35 pm, Christian Hesse wrote:
[...]
Typo
Uups, typing too fast. :-p
+ if (q->key->uid == NULL) { + q->import = yesno(_("Import PGP key %s with unknown uid?"),
This is not a great question. I had a fair idea what you were doing, and I still thought "what is a uid?".
Other options:
Import PGP key %s from unknown source?
In terms of gpg key I would expect the source to be "keyserver" or "wkd". For me this is even more confusing.
Import PGP key %s?
I'd prefer this one. -- main(a){char*c=/* Schoene Gruesse */"B?IJj;MEH" "CX:;",b;for(a/* Best regards my address: */=0;b=c[a++];) putchar(b-1/(/* Chris cc -ox -xc - && ./x */b/42*2-3)*42);}
From: Christian Hesse <mail@eworm.de> If the key's uid is unknown (for example with db signatures) the question was: :: Import PGP key 02FD1C7A934E614545849F19A6234074498E9CEE, "(null)"? [Y/n] Let's display a modified question for unknown uid. Signed-off-by: Christian Hesse <mail@eworm.de> --- src/pacman/callback.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/pacman/callback.c b/src/pacman/callback.c index 25528100..3e67c1d8 100644 --- a/src/pacman/callback.c +++ b/src/pacman/callback.c @@ -456,8 +456,14 @@ void cb_question(alpm_question_t *question) case ALPM_QUESTION_IMPORT_KEY: { alpm_question_import_key_t *q = &question->import_key; - q->import = yesno(_("Import PGP key %s, \"%s\"?"), - q->key->fingerprint, q->key->uid); + /* the uid is unknown with db signatures */ + if (q->key->uid == NULL) { + q->import = yesno(_("Import PGP key %s?"), + q->key->fingerprint); + } else { + q->import = yesno(_("Import PGP key %s, \"%s\"?"), + q->key->fingerprint, q->key->uid); + } } break; }
participants (2)
-
Allan McRae
-
Christian Hesse