2

I have used meld to merge the conflicted files in git for a long time while running on Ubuntu. Now I need to merge files, but my environnement has changed. I now use a PC on Windows 7, and connects to a CentOS server using Putty. I installed meld on the server :

Package meld-1.3.1-2.el6.noarch already installed and latest version

I tried even to install meld for windows on my PC... it doesn't help. When running :

git mergetool -t meld

Here's the response :

Merging the files: gagglon/v4/www/includes/php/test.php
Normal merge conflict for 'gagglon/v4/www/includes/php/test.php':
{local}: modified
{remote}: modified
Hit return to start merge resolution tool (meld):
Traceback (most recent call last):
File "/usr/bin/meld", line 61, in <module>
import gtk
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 64, in <module>
_init()
File "/usr/lib64/python2.6/site-packages/gtk-2.0/gtk/__init__.py", line 52, in _init
_gtk.init_check()
RuntimeError: could not open display
gagglon/v4/www/includes/php/test.php seems unchanged.
Was the merge successful? [y/n] n
merge of gagglon/v4/www/includes/php/test.php failed

What can I do to get meld back, or could you help me find another tool I could use that would be also easy to use like meld ? Any easy interface would do...

Thanks ahead !

Jeremy Belolo
  • 4,319
  • 6
  • 44
  • 88
  • 1
    Is it a `DISPLAY` environment variable issue, as in https://bugzilla.redhat.com/show_bug.cgi?id=591502? – VonC Oct 13 '13 at 15:43
  • I didn't even knew what were environnment variable ^^ Yet a printenv command doesn't show any DISPLAY variable, even after fresh launching of a terminal... – Jeremy Belolo Oct 13 '13 at 16:11

1 Answers1

1

On CentOS, most of the threads I found insist on the importance of setting properly the environment variable $DISPLAY.

Noticed that there DISPLAY environment variable was gone in that terminal session.
Opening new terminal session or use different terminal session solves the problem...

export DISPLAY=":1.0"

But on putty, is is harder, as explained in this thread:

All the system-config commands are designed to be ran via X11 (a Linux GUI).
From the error messages its trying to run gtk commands which means its trying to open a GUI window, which is not going to happen via putty.
I would look for other commands to setup what your trying to do.

Why wouldn't you use meld on Windows directly?

With putty only, you can try this solution, based on X11 forwarding:

https://i.stack.imgur.com/Vpiko.jpg

That means:

  • installing an X11 server on Windows, like XMing,
  • don't forget the fonts: yum install xorg-x11-font*.
Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Very interesting, thank you, I read the same thread earlier but didn't understand all of this... I have installed Meld on Windows, but the git is installed on the server and using git mergetool on the server won't trigger a software running on the local machine, I guess... I could be wrong, but if so I didn't find how to. This said, I'm a little confuse, what help would bring to set the display variable by following the X11 forwarding solution ? – Jeremy Belolo Oct 13 '13 at 19:06
  • 1
    @JeremyBelolo it would declare the Windows display for the X11 of your Centos to use. – VonC Oct 13 '13 at 19:27
  • Hi, thanks again... But still doesn't work. DISPLAY=localhost:10.0 appears on printenv, but still getting RuntimeError: could not open display. – Jeremy Belolo Oct 14 '13 at 08:23
  • 1
    @JeremyBelolo maybe "localhost" isn't properly interpreted. Try that tutorial to see if it works better: http://www.math.umn.edu/systems_guide/putty_xwin32.html – VonC Oct 14 '13 at 08:28
  • @JeremyBelolo and you might be missing an X11 server running on your Windows, like XMing, as mentioned in http://courses.cms.caltech.edu/cs11/misc/xwindows.html. – VonC Oct 14 '13 at 08:29
  • LOL that's something like fabulous ^^ That kinda worked, but kinda... Well, look : http://i.imgur.com/bkXS7Xw.png ... I was like "hurray" when it opened and then "oooohhhh" :) – Jeremy Belolo Oct 14 '13 at 11:52
  • /usr/share/meld/meldapp.py:502: PangoWarning: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='latin' self.widget.show() /usr/share/meld/meldapp.py:502: PangoWarning: failed to choose a font, expect ugly output. engine-type='PangoRenderFc', script='common' self.widget.show() – Jeremy Belolo Oct 14 '13 at 11:53
  • np, lets just continue here :) Have yo ugot an idea of what I should do to get this font issue fixed ? – Jeremy Belolo Oct 14 '13 at 11:59
  • @JeremyBelolo do you have installed an X11 server on your Windows? – VonC Oct 14 '13 at 11:59
  • 1
    @JeremyBelolo that X11 server should include fonts (mentioned in http://stackoverflow.com/a/5812485/6309) – VonC Oct 14 '13 at 12:00
  • I was looking at the exact same thread. I'm going to give it a try – Jeremy Belolo Oct 14 '13 at 12:01
  • yum install xorg-x11-font* did it ! success :) Thank you very much for your help, you rocks ! – Jeremy Belolo Oct 14 '13 at 12:05
  • 1
    @JeremyBelolo great! I have added the two steps (X11 server and fonts) in the answer for more visibility. – VonC Oct 14 '13 at 12:08