Bad error message when EDITOR is not set.
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Bazaar |
Fix Released
|
Low
|
Unassigned |
Bug Description
example:
% unset EDITOR
% bzr commit
bzr: ERROR: [Errno 2] No such file or directory
command: '/usr/bin/bzr' 'commit'
pwd: u'xxx.py'
error: exceptions.OSError
at /usr/lib/
see ~/.bzr.log for debug information
%
Traceback (most recent call last):
File "/usr/lib/
return run_bzr(argv)
File "/usr/lib/
ret = cmd_obj.
File "/usr/lib/
return self.run(
File "/usr/lib/
message = edit_commit_
File "/usr/lib/
if not _run_editor(
File "/usr/lib/
x = call(edargs + [filename])
File "/usr/lib/
return Popen(*args, **kwargs).wait()
File "/usr/lib/
errread, errwrite)
File "/usr/lib/
raise child_exception
OSError: [Errno 2] No such file or directory
description: | updated |
Changed in bzr: | |
status: | In Progress → Fix Committed |
Changed in bzr: | |
status: | Fix Committed → Fix Released |
In 0.7 if EDITOR and BZR_EDITOR are not set, bzr tries to use a reasonable editor based on platform.
However, if EDITOR is set to something non-existant, we fail to trap the exception. python2. 4/subprocess. py line 975
$ EDITOR=bogus bzr commit
bzr: ERROR: exceptions.OSError: [Errno 2] No such file or directory
at /usr/lib/
in _execute_child
We probably just want a try/except around the subprocess.call() function at line 54 in msgeditor.py
Something like this: msgeditor. py'
=== modified file 'bzrlib/
--- bzrlib/msgeditor.py
+++ bzrlib/msgeditor.py
@@ -20,6 +20,7 @@
"""Commit message editor support."""
import os
+import errno
from subprocess import call
import bzrlib.config as config
@@ -51,7 +52,13 @@
"""Try to execute an editor to edit the commit message."""
for e in _get_editor():
edargs = e.split(' ')
- x = call(edargs + [filename])
+ try:
+ x = call(edargs + [filename])
+ except OSError, e:
+ # ENOENT means no such editor
+ if e.errno == errno.ENOENT:
+ continue
+ raise
if x == 0:
return True
elif x == 127:
Present on my jam-pending branch (revno 1509)