error on parsing empty application name from malformed desktop entry

Bug #526357 reported by mtou on 2010-02-23
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zeitgeist Framework
Fix Released
Siegfried Gevatter

Bug Description

I've got a malformed Desktop Entry installed user-related; malformed because the "Exec=*" line in it doesn't have any application string defined and it should [1]. Anyway, it's there, malformed, and raises an error.

Traceback (most recent call last):
  File "/home/mtou/zeitgeist/zeitgeist/zeitgeist/../", line 108, in _update_db_async
    events = self._sources_queue[0].get_items()
  File "/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/", line 84, in get_items
    return self._get_items()
  File "/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/datasources/", line 290, in _get_items
    desktopfile = self._find_desktop_file_for_application(application)
  File "/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/datasources/", line 263, in _find_desktop_file_for_application
    line.split("=", 1)[-1].strip().split()[0] == application:
IndexError: list index out of range

Fix :
replace lines ~261 in _zeitgeist/loggers/datasources/
if line.startswith("Exec") and \
line.split("=", 1)[-1].strip().split()[0] == application:
    return unicode(fullname)
execlinepattern = re.compile("^Exec\b*=\b*\S+")
if execlinepattern.match(line) is not None and \
line.split("=", 1)[-1].strip().split()[0] == application:
    return unicode(fullname)

Feel free to push the pattern upward to optimise.

One could even use full regexp extraction to get the application, but I'm not familiar enough with python to code it.

Appears on zeitgeist trunk and ubuntu jaunty PPA package.


Siegfried Gevatter (rainct) wrote :

Fixed, thanks.

affects: zeitgeist-dataproviders → zeitgeist
Changed in zeitgeist:
assignee: nobody → Siegfried Gevatter (rainct)
importance: Undecided → Medium
status: New → Fix Released
milestone: none → 0.3.3
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers