gpg doesn't display photo ids when in --with-colons mode
Closed, ResolvedPublic

Description

Release: STABLE-1-2

Environment

Any. Patch tested and verified on s390-ibm-linux-gnu.

Description

GnuPG does not call the photo viewer when keys are listed in --with-colons mode. The only way to get the image data in this case is to parse the packets sent to the --attribute-fd, which is difficult to do from a shell script (and not properly documented as well -- i.e. how do I properly parse the stream(s) from --status-fd and --attribute-fd?). It would be nice to display photos in this case as well, so I can specify an "image viewer" that echoes a magic word into the --with-colons output or sth. like that.

I have included a patch, however this one does not correctly handle the case when photo ids are enabled in the config file and some software expects --with-colons to be noninteractive. Perhaps --batch-mode should turn off photo viewing again?

How To Repeat

Given a keyring with a key containing a photo ID in it.

gpg --list-keys --with-colons --photo-viewer 'echo %i' --show-photos

Fix

Possible patch attached, please respond if not sufficient.

dshaw added a subscriber: dshaw.Jul 1 2003, 3:16 AM

Photo IDs not appearing in the --with-colons listing is a
feature, not a bug. The assumption is that when in
--with-colons mode, GnuPG is being called from an external
program and to cause a viewer to execute (and possibly pop
up a window) violates that intent.

That said, I'll document the --attribute-fd format for the
next version. It is pretty simple, and for most purposes
you can just throw away the first 16 bytes and treat the
rest as a JPEG file.

werner added a subscriber: werner.

[from gnupg/186]
Hrm, that was also my impression. My idea was to use
--batch-mode to
show that photos should not be displayed unless
--show-photos was also
explicitly given.

While that is (nearly) fine for an application, it is hard to do
properly for a script. Also, there is no way to parse that
stream
properly unless I implement a full JPEG parser, since there
may be
multiple photo IDs and there is no way to separate them in
the stream,
and it is also hard to associate these files back to the
--list-keys
output since the stream does not have any information about
which photo
belongs to which key.

It's just simpler to use "gpg --batch --show-photos
--photo-viewer 'cp
%i /tmp/%k.jpg'" --with-colons --list-keys" than parse the
--attribute-fd stream, especially since the latter cannot
be done
correctly ATM.

Simon

Accidently re-opened instead of closing it.

werner closed this task as Resolved.Jul 30 2003, 2:43 PM