Meld syntax highlighting does not work

Bug #152913 reported by Jonathan
10
Affects Status Importance Assigned to Milestone
meld
Fix Released
Low
meld (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: meld

The title says it all, really. Enabling syntax highlighting in the preferences dialog of meld has no effect.

python-pygtksourceview is installed (see below)

dpkg -s meld python-pygtksourceview
Package: meld
Status: install ok installed
Priority: optional
Section: gnome
Installed-Size: 2140
Maintainer: Ubuntu MOTU Developers <email address hidden>
Architecture: all
Version: 1.1.5.1-0ubuntu1
Depends: python, python-support (>= 0.2), python-gtk2 (>= 2.4), python-glade2 (>= 2.4), python-gnome2, patch
Recommends: python-gnome2-extras
Description: graphical tool to diff and merge files
 Meld is a tool which allows the user to see the changes in, and merge between,
 either two files, two directories, or two files with a common ancestor.
Original-Maintainer: Ross Burton <email address hidden>

Package: python-pygtksourceview
Status: install ok installed
Priority: extra
Section: python
Installed-Size: 308
Maintainer: Ubuntu Desktop Team <email address hidden>
Architecture: i386
Source: pygtksourceview
Version: 2.0.0-0ubuntu3
Depends: libatk1.0-0 (>= 1.13.2), libc6 (>= 2.6-1), libcairo2 (>= 1.4.0), libfontconfig1 (>= 2.4.0), libglib2.0-0 (>= 2.14.0), libgtk2.0-0 (>= 2.12.0), libgtksourceview2.0-0 (>= 1.90.4), libpango1.0-0 (>= 1.18.1), libx11-6, libxcomposite1 (>= 1:0.3-1), libxcursor1 (>> 1.1.2), libxdamage1 (>= 1:1.1), libxext6, libxfixes3 (>= 1:4.0.1), libxi6, libxinerama1, libxml2 (>= 2.6.29), libxrandr2 (>= 2:1.2.0), libxrender1, python-central (>= 0.5.8), python (>= 2.5), python (<< 2.6)
Description: python bindings for the version 2 of the GtkSourceView library
 GtkSourceView is a text widget that extends the standard GTK+ 2.x text widget
 GtkTextView. It improves GtkTextView by implementing syntax highlighting and
 other features typical of a source editor.
Original-Maintainer: Sebastien Bacher <email address hidden>
Python-Version: 2.5

Related branches

Revision history for this message
Leslie Viljoen (leslieviljoen) wrote :

Same version works for me, comparing C++ and Ruby files. Perhaps it would be useful if you mentioned what your file types and file names are. Meld does not syntax highlight my C++ files if they are called *.bak, but I think that's fair.

Revision history for this message
Jonathan (jpl) wrote :

OK, I've checked by manually comparing two C files, and it works fine. However, if I run it from my Perforce client (my usual use case), it does not. In this case, the filenames used are

/tmp/lucas(p4v)/itbr174_a.x.com_1666/software/main.br/scheduler/private/cet_interrupt#94.c and /tmp/lucas(p4v)/itbr174_a.x.com_1666/software/main.br/scheduler/private/cet_interrupt#95.c

Given the final .c extension, I think it's reasonable to expect C highlighting. I guess the problem is the brackets, the hash or the dots in the filename?

Revision history for this message
Leslie Viljoen (leslieviljoen) wrote :

The hash causes syntax errors:

Traceback (most recent call last):
  File "/usr/lib/meld/task.py", line 131, in iteration
    ret = task()
  File "/usr/lib/meld/filediff.py", line 671, in _set_files_internal
    set_highlighting_enabled( self.textview[i].get_buffer(), files[i], self.prefs.use_syntax_highlighting )
  File "/usr/lib/meld/filediff.py", line 51, in set_highlighting_enabled
    mime_type = gnomevfs.get_mime_type( os.path.abspath(fname) )
RuntimeError: there was an error reading the file

At the command line the brackets also need to be escaped but I don't think that is your problem when meld is called from perforce. The hash is most likely the problem.

And since it looks like the hash is indicating a version number, you are stuck.

Looks like a bug in the function gnomevfs.get_mime_type to me.

Revision history for this message
Ivan Sergeyenko (svintus) wrote :

The problem is in the following line in filediff.py:

mime_type = gnomevfs.get_mime_type( os.path.abspath(fname) )

The path is not properly escaped before being passed to get_mime_type. You can just replace this line by the following:

import urllib
mime_type = gnomevfs.get_mime_type( urllib.quote(os.path.abspath(fname)) )

Revision history for this message
Jonathan (jpl) wrote :

Yep, that fixes the problem. Thanks for the tip.

Jonathan

Revision history for this message
Ivan Sergeyenko (svintus) wrote :

I have submitted the bug report/patch to meld bugzilla.

Revision history for this message
Adam Collard (adam-collard) wrote :

Confirmed on hardy (1.1.5.1-2ubuntu1)

Changed in meld:
status: New → Confirmed
Changed in meld:
status: Unknown → New
Changed in meld:
status: New → Fix Released
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package meld - 1.2-0ubuntu1

---------------
meld (1.2-0ubuntu1) jaunty; urgency=low

  * New upstream release. (LP: #283725)
  * debian/copyright:
    - Updated email of upstream author to what is stated in MAINTAINERS.
  * debian/control.in:
    - Bumped standards-version to 3.8.0.
  * debian/patches/html_patch_by_kai_willadsen.patch:
    - Removed, fixed upstream.
  * debian/patches/fix-fr-help-makefile.patch:
    - Ignore error when trying to install files from the non existent
      directory 'help/fr/figures'.
  * debian/patches/only-ignore-fully-blank-changes.patch:
    - Do not jump to the last blank change in blank changes are ignored and
      do not jump over blank changes if they are not ignored. Fixes bug that
      caused some differences to be ignored when using 'Up and 'Down' buttons.
      Patch by Martin Renold. (LP: #234259)
  * debian/patches/escape-paths.patch:
    - Escape paths so mime type is recoqnized correctly. Patch by Ivan
      Sergeyenko. Fixed in upstream development version. (LP: #152913)

 -- Michael Budde <email address hidden> Sat, 15 Nov 2008 13:35:17 +0100

Changed in meld:
status: Confirmed → Fix Released
Changed in meld:
importance: Unknown → Low
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.