saving of commit messages during uncommit should be built in

Bug #545050 reported by GuilhemBichot on 2010-03-23
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Medium
Unassigned
Bazaar GTK+ Frontends
Medium
Unassigned
QBzr
Medium
Unassigned

Bug Description

I ssh to a machine (without X-forwarding) and there I do "bzr uncommit":

bzr: ERROR: exceptions.RuntimeError: could not open display

Traceback (most recent call last):
 File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 853, in exception_to_return_code
   return the_callable(*args, **kwargs)
 File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 1055, in run_bzr
   ret = run(*run_argv)
 File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 661, in run_argv_aliases
   return self.run_direct(**all_cmd_args)
 File "/usr/lib64/python2.4/site-packages/bzrlib/commands.py", line 665, in run_direct
   return self._operation.run_simple(*args, **kwargs)
 File "/usr/lib64/python2.4/site-packages/bzrlib/cleanup.py", line 121, in run_simple
   return _do_with_cleanups(
 File "/usr/lib64/python2.4/site-packages/bzrlib/cleanup.py", line 156, in _do_with_cleanups
   result = func(*args, **kwargs)
 File "/usr/lib64/python2.4/site-packages/bzrlib/builtins.py", line 4699, in run
   return self._run(b, tree, dry_run, verbose, revision, force, local=local)
 File "/usr/lib64/python2.4/site-packages/bzrlib/builtins.py", line 4751, in _run
   revno=revno, local=local)
 File "/usr/lib64/python2.4/site-packages/bzrlib/uncommit.py", line 111, in uncommit
   hook_new_tip)
 File "/usr/lib64/python2.4/site-packages/bzrlib/plugins/gtk/__init__.py", line 161, in save_commit_messages
   from bzrlib.plugins.gtk import commit
 File "/usr/lib64/python2.4/site-packages/bzrlib/plugins/gtk/commit.py", line 26, in ?
   import gtk
 File "/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 76, in ?
   _init()
 File "/usr/lib64/python2.4/site-packages/gtk-2.0/gtk/__init__.py", line 64, in _init
   _gtk.init_check()
RuntimeError: could not open display

bzr 2.1.0 on python 2.4.3 (Linux-2.6.18-128.el5-x86_64-with-redhat-5.3-Tikanga)
arguments: ['/usr/bin/bzr', 'uncommit']
encoding: 'UTF-8', fsenc: 'UTF-8', lang: 'en_US.UTF-8'
plugins:
 gtk /usr/lib64/python2.4/site-packages/bzrlib/plugins/gtk [0.98.0.final.1]

When executing bzr-gtk's post-uncommit hook, "import gtk" is executed, which fails as there is no X session.
Suggested fix: let the post-uncommit hook not require the graphical parts of bzr-gtk.
Workaround: bzr --no-plugins uncommit

Jelmer Vernooij (jelmer) wrote :

The saving of commit messages on uncommit really should be moved into bzr core.

Vincent Ladeuil (vila) on 2010-03-23
Changed in bzr-gtk:
status: New → Confirmed
importance: Undecided → Medium
Martin Pool (mbp) on 2010-05-26
summary: - "bzr uncommit" fails if no X session (gtk error)
+ saving of commit messages during uncommit should be built in
Martin Pool (mbp) on 2010-05-26
Changed in bzr:
status: New → Confirmed
importance: Undecided → Medium
Changed in qbzr:
status: New → Confirmed
importance: Undecided → Medium
GuilhemBichot (guilhem-bichot) wrote :

I don't know whether it should be built in; as long as "uncommit" works even when no X session is available, I'll be happy.

On 27 May 2010 22:49, GuilhemBichot <email address hidden> wrote:
> I don't know whether it should be built in; as long as "uncommit" works
> even when no X session is available, I'll be happy.

Ah, are you saying that uncommit always fails totally? That would
suck, though I think it may already be fixed. I'll check.

--
Martin <http://launchpad.net/~mbp/>

Martin Pool (mbp) wrote :

On 28 May 2010 08:52, Martin Pool <email address hidden> wrote:
> On 27 May 2010 22:49, GuilhemBichot <email address hidden> wrote:
>> I don't know whether it should be built in; as long as "uncommit" works
>> even when no X session is available, I'll be happy.
>
> Ah, are you saying that uncommit always fails totally?  That would
> suck, though I think it may already be fixed.  I'll check.

At the moment (bzr, bzr-gtk tip) you get:

mbp@lithe% DISPLAY= bzr uncommit
  694 Martin Pool 2010-05-28
      foo

The above revision(s) will be removed.
Are you sure? [y/n]: y
/usr/lib/pymodules/python2.6/gtk-2.0/gtk/__init__.py:57: GtkWarning:
could not open display
  warnings.warn(str(e), _gtk.Warning)
You can restore the old tip by running:
  bzr pull . -r revid:<email address hidden>

Since you're not actually asking for anything to do with the display
we shouldn't give the message either.

--
Martin <http://launchpad.net/~mbp/>

GuilhemBichot (guilhem-bichot) wrote :

Hello Martin, I get the same warning as you, which is ok (we can live with the warning; the revision has been uncommitted).
But my colleague, who is using python 2.4, and a gtk module with versions:
 gtk version is (2,10,4)
 pygtk version is (2,10,1)
still sees the stack trace and exception. This is understandable:
his gtk/__init__.py has:
def _init():
...
    _gtk.init_check()
which fails and throws RuntimeError (we see it in the stack trace in a previous post).
Whereas my gtk/__init__.py has:
        try:
            _gtk.init_check()
        except RuntimeError, e:
            import warnings
            warnings.warn(str(e), _gtk.Warning)
which catches the exception and sends a warning instead.

GuilhemBichot (guilhem-bichot) wrote :

it's not trivial for the colleague to upgrade gtk; he's using a shared machine in a lab, administered by others. But if it's what needed (not fixable in bzr-gtk), we can ask for an upgrade.

GuilhemBichot (guilhem-bichot) wrote :

Still occurs with 0.98 but I wonder if this revision could fix it:
http://bazaar.launchpad.net/~bzr-gtk/bzr-gtk/gtk3/revision/742
?

GuilhemBichot (guilhem-bichot) wrote :

I wanted to test with a version having revno 742, so I tried 0.103. But that requires gtk3, and our machines are gtk2, and upgrading to gtk3 is major pain.
What is the plan for bzr-gtk vs gtk2? have you stopped supporting it?

Curtis Hovey (sinzui) wrote :

There are no place to backport fixes in trunk (gtk3) to gtk2 except to address security issues.

Jelmer Vernooij (jelmer) on 2017-11-09
tags: added: check-for-breezy
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers