Public bug reported:

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/../zeitgeist-datahub.py", line 
108, in _update_db_async
    events = self._sources_queue[0].get_items()
  File 
"/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/zeitgeist_base.py",
 line 84, in get_items
    return self._get_items()
  File 
"/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/datasources/recent.py",
 line 290, in _get_items
    desktopfile = self._find_desktop_file_for_application(application)
  File 
"/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/datasources/recent.py",
 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/recent.py 
from
---
if line.startswith("Exec") and \
line.split("=", 1)[-1].strip().split()[0] == application:
    return unicode(fullname)
---
to
---
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.


[1] http://standards.freedesktop.org/desktop-entry-
spec/latest/ar01s06.html

** Affects: zeitgeist-dataproviders
     Importance: Undecided
         Status: New

-- 
error on parsing empty application name from malformed desktop entry
https://bugs.launchpad.net/bugs/526357
You received this bug notification because you are a member of Zeitgeist
Framework Team, which is subscribed to Zeitgeist Data-Sources.

Status in Zeitgeist Data-Sources: New

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/../zeitgeist-datahub.py", line 
108, in _update_db_async
    events = self._sources_queue[0].get_items()
  File 
"/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/zeitgeist_base.py",
 line 84, in get_items
    return self._get_items()
  File 
"/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/datasources/recent.py",
 line 290, in _get_items
    desktopfile = self._find_desktop_file_for_application(application)
  File 
"/home/mtou/zeitgeist/zeitgeist/zeitgeist/../_zeitgeist/loggers/datasources/recent.py",
 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/recent.py 
from
---
if line.startswith("Exec") and \
line.split("=", 1)[-1].strip().split()[0] == application:
    return unicode(fullname)
---
to
---
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.



[1] http://standards.freedesktop.org/desktop-entry-spec/latest/ar01s06.html



_______________________________________________
Mailing list: https://launchpad.net/~zeitgeist
Post to     : zeitgeist@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zeitgeist
More help   : https://help.launchpad.net/ListHelp

Reply via email to