[MERGE] Improve error handling in msgeditor._run_editor.

Andrew Bennetts andrew.bennetts at canonical.com
Wed Dec 17 23:53:14 GMT 2008


A user on IRC just reported trouble using “bzr commit” without -m.  It
turned out that somehow they had this line in their bazaar.conf:

    editor = ""

There are two issues here.  First is that executing "" causes EACCES, and
_run_editor wasn't catching that.  The second is that the error reporting
was very unhelpful in this case; it didn't report which command bzr was
trying to run, or why.

So this patch fixes both.  It catches EACCES in _run_editor (which could
happen if the editor isn't executable or readable as well), and it also
emits a warning to the user if a configured editor is not exectuable, on the
basis that that means their configuration/environment is probably not sane.
It *doesn't* emit that warning when trying the hardcoded guesses
(notepad.exe, /usr/bin/editor, etc), only for user-controllable values.

I'm interested in feedback about emitting a warning in this situation.  On
one hand, it would have made this problem easier to diagnose — the user on
IRC today probably wouldn't have needed to come to #bzr for help if we
emitted it.  But maybe it's too chatty to complain if a user's environment
is slightly broken?  I think probably this change is fine (it's usually not
hard to set $EDITOR correctly), but I know extra output can irritate people,
so let me know.

-Andrew.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: msgeditor-failure-handling-3911.patch
Type: text/x-diff
Size: 8936 bytes
Desc: not available
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081218/4e9e1bc2/attachment.bin 


More information about the bazaar mailing list