Photo ID race condition
keith at nullify.org
Tue May 28 11:48:01 CEST 2002
Quoting David Shaw <dshaw at jabberwocky.com>:
> On Mon, May 27, 2002 at 11:54:50AM -0500, Keith Ray wrote:
> > There is a (non-security) race condition in the photo ID code under
> > Windows. If the user has a slow loading image viewer (ie. Mozilla), GnuPG
> > could delete the temp file before the viewer finishes initializing. I can
> > think of a number of solutions:
> > 1. Wait for the viewer to exit before returning to GnuPG.
> > 2. Insert a delay between exec_read() and exec_finish(). Then again, on a
> > slow system with little RAM, how much is enough?
> > 3. Delay deleting the temp files until GnuPG exits.
> This is a known problem with 1.0.7 (1.0.7 was never really intended
> for widespread Win32 use). Until 1.0.8 is released with a
> non-system()-based implementation of the exec code, you have a few
> 1) Patch the code based on the CVS
> 2) Use %I instead of %i in your photo-viewer command line
> 3) Try a photo-viewer of "start /w %i.jpg"
> (#3 should work but I haven't tested it - I'm traveling and have no
> access to a windows box at the moment)
Hmm, I should have been more explicit on my setup ;) I was using 1.0.7a-cvs
from May 24. The photo viewer was the default:
#define DEFAULT_PHOTO_COMMAND "start /w %i"
Mozilla is the default .jpg viewer. For some reason, execution returns to
GnuPG immediately after launching Mozilla. Mozilla does not finish loading
itself and then the picture before GnuPG deletes the temporary directory and
file. Thus, solution #3 isn't working.
Unless there is a way to modify the "start" command to actually wait when
launching an object file instead of an executable, I think the best route would
be to read the registry to find the default viewer and then "start" that.
I will code up a patch against CVS and e-mail it to you when I'm done.
More information about the Gnupg-devel