Race condition in mailto-mutt

Bug #799627 reported by Victor Engmark
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mutt (Ubuntu)
New
Undecided
Unassigned

Bug Description

Binary package hint: mutt

How to reproduce: Either setup /usr/lib/mutt/mailto-mutt as the mailto: link handler in Firefox and click on a mailto: link, or run `/usr/lib/mutt/mailto-mutt "mailto: link contents"` in Bash in GNOME Terminal.

Result: Most of the time (more than 90%) a window pops up and disappears immediately. When running it in Bash/GNOME Terminal it returns exit code zero and no error message.

Cause: It looks like there's a race condition: x-terminal-emulator forks a GNOME Terminal so the `rm -f $TMPFILE` command two lines down gets executed before mutt has a chance to read it. As such, it will exit immediately.

Workaround: Add a line with `sleep 1` above the `rm -f $TMPFILE` line.

Suggestions:
1. Make sure the `rm` command is only run after mutt has actually finished (or at least has had time to read it. I don't know whether mutt clears up temp files passed with -i by default).
2. Try to retrieve the exit code of mutt itself for the `exit` statement. I guess this would necessitate a change in gnome-terminal, to return the exit code of the commend executed with -e.

ProblemType: Bug
DistroRelease: Ubuntu 10.10
Package: mutt 1.5.20-9ubuntu2 [modified: usr/lib/mutt/mailto-mutt]
ProcVersionSignature: Ubuntu 2.6.35-28.50-generic 2.6.35.11
Uname: Linux 2.6.35-28-generic x86_64
NonfreeKernelModules: nvidia wl
Architecture: amd64
Date: Mon Jun 20 09:52:38 2011
InstallationMedia: Ubuntu 10.10 "Maverick Meerkat" - Release amd64+mac (20101008)
ProcEnviron:
 PATH=(custom, user)
 LANG=en_US.utf8
 SHELL=/bin/bash
SourcePackage: mutt

Revision history for this message
Victor Engmark (victor-engmark) wrote :
Revision history for this message
Victor Engmark (victor-engmark) wrote :

Turns out this is caused by bug #666418 - "gnome-terminal.wrapper doesn't wait until program finishes".

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.