Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 282337 - x11-misc/alacarte-0.12.1 fails to start and produces a traceback
Summary: x11-misc/alacarte-0.12.1 fails to start and produces a traceback
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: AMD64 Linux
: High normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-22 17:08 UTC by Brian Dolbec (RETIRED)
Modified: 2009-08-27 08:54 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Dolbec (RETIRED) gentoo-dev 2009-08-22 17:08:41 UTC
alacarte fails to path valid strings to the os.path.join() resulting in os.path.join() to produce a traceback.

Reproducible: Always

Steps to Reproduce:
1.in a terminal run alacarte
2.
3.

Actual Results:  
brian@big_daddy ~ $ alacarte
Traceback (most recent call last):
  File "/usr/bin/alacarte", line 36, in <module>
    main()
  File "/usr/bin/alacarte", line 32, in main
    app = MainWindow(datadir, version, sys.argv)
  File "/usr/lib64/python2.6/site-packages/Alacarte/MainWindow.py", line 48, in __init__
    self.editor = MenuEditor()
  File "/usr/lib64/python2.6/site-packages/Alacarte/MenuEditor.py", line 36, in __init__
    self.__loadMenus()
  File "/usr/lib64/python2.6/site-packages/Alacarte/MenuEditor.py", line 42, in __loadMenus
    self.applications.path = os.path.join(util.getUserMenuPath(), self.applications.tree.get_menu_file())
  File "/usr/lib64/python2.6/posixpath.py", line 65, in join
    if b.startswith('/'):
AttributeError: 'NoneType' object has no attribute 'startswith'


Expected Results:  
the application to start.

I have patched python's os.patch.join() see bug [url=http://bugs.gentoo.org/show_bug.cgi?id=282318]282318[/url] to handle Nonetype objects.  It turns out that alacarte is passing both primary and secondary parameters as NoneType objects.

After patching for secondary parameters I got this traceback:

brian@big_daddy ~ $ alacarte
Traceback (most recent call last):
  File "/usr/bin/alacarte", line 36, in <module>
    main()
  File "/usr/bin/alacarte", line 32, in main
    app = MainWindow(datadir, version, sys.argv)
  File "/usr/lib64/python2.6/site-packages/Alacarte/MainWindow.py", line 48, in __init__
    self.editor = MenuEditor()
  File "/usr/lib64/python2.6/site-packages/Alacarte/MenuEditor.py", line 36, in __init__
    self.__loadMenus()
  File "/usr/lib64/python2.6/site-packages/Alacarte/MenuEditor.py", line 42, in __loadMenus
    self.applications.path = os.path.join(util.getUserMenuPath(), self.applications.tree.get_menu_file())
  File "/usr/lib64/python2.6/posixpath.py", line 70, in join
    path += '/' + b
TypeError: cannot concatenate 'str' and 'NoneType' objects


So I patched it for primary NoneType objects and alarte continues along only to fail in other parts of it's program.  (Not suprized)

I do not know if this is a result of running it from an xfce session, not having run a gnome session yet or that so far I've not been able to get xfce-desktop to run properly.  Still no background image. no desktop menus, etc..

I would expect alacarte to at least produce a dialog/error message stating that vital path info was missing so was unable to continue.
Comment 1 Brian Dolbec (RETIRED) gentoo-dev 2009-08-22 17:10:50 UTC
sorry, I used forums syntax. python bug 282318
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-08-22 18:10:52 UTC
Assinging to maintainers
Comment 3 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-08-26 21:31:25 UTC
do you have dev-python/pyxdg or x11-misc/xdg-utils installed ? If not could you check that installing them solves the problem ?
Comment 4 Brian Dolbec (RETIRED) gentoo-dev 2009-08-27 04:59:46 UTC
sorry to say, but both were installed.

A re-emerge of them did not change it's behaviour
Comment 5 Brian Dolbec (RETIRED) gentoo-dev 2009-08-27 05:15:37 UTC
I re-emerged alacarte, but no change.  Also I tried alacarte-0.11.10 It also fails with the same error.
Comment 6 Brian Dolbec (RETIRED) gentoo-dev 2009-08-27 06:05:47 UTC
I've done some more investigation, including add a couple prinstatements to alacarte's MenuEditor.py just before the failure.  It turns out that gmenu is returning None, causing the failure.  I believe it is returning none since it looks like the file does not exist.

live python session to trace some steps of what alacarte is doing on startup:

brian@big_daddy ~/porthole $ python
Python 2.6.2 (r262:71600, Aug 25 2009, 20:03:50) 
[GCC 4.3.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> os.environ.has_key('XDG_CONFIG_HOME')
False
>>> os.path.join(os.environ['HOME'], '.config', 'menus')
'/home/brian/.config/menus'
>>> menu_dir = os.path.join(os.environ['HOME'], '.config', 'menus')
>>> os.path.isfile(os.path.split(menu_dir)[0])
False
>>> os.path.isdir(menu_dir)
True
>>> menu_dir
'/home/brian/.config/menus'
>>> import gmenu
>>> gmenu.lookup_tree('applications.menu', gmenu.FLAGS_SHOW_EMPTY|gmenu.FLAGS_INCLUDE_EXCLUDED|gmenu.FLAGS_INCLUDE_NODISPLAY|gmenu.FLAGS_SHOW_ALL_SEPARATORS)
<gmenu.Tree object at 0x7f04be74a090>
>>> tree=gmenu.lookup_tree('applications.menu', gmenu.FLAGS_SHOW_EMPTY|gmenu.FLAGS_INCLUDE_EXCLUDED|gmenu.FLAGS_INCLUDE_NODISPLAY|gmenu.FLAGS_SHOW_ALL_SEPARATORS)
>>> visible_tree=gmenu.lookup_tree('applications.menu')
>>> f=tree.get_menu_file()
>>> f
>>> f==None
True
>>> 



I've also checked teh '/home/brian/.config/menus' directory and its only contents are one subdir which has some wine installed progs.

Perhaps it is due to not having run a gnome session yet.
Comment 7 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-08-27 06:44:51 UTC
do you have XDG_MENU_PREFIX defined in your environment. Starting with gnome-menus-2.26.2, this is a necessity due to collision with kde's menus. alacarte doesn't fail to start here but my environment has this variable set to "gnome-" since I'm using a gnome-session. Last time I spoke with xfce's gentoo dev, they told me xfce did not have menus, is that still true ?
Comment 8 Brian Dolbec (RETIRED) gentoo-dev 2009-08-27 07:15:56 UTC
No, I do not have that one in my environment.

Currently in xfce-4.6 there is not a menu editor.  Menus have to be hand copied/edited from what I'm finding out tonight.   So far my xfce session is using the default menus setup.  There is not a ~/.config/menus/xfce-applications.menu
Comment 9 Brian Dolbec (RETIRED) gentoo-dev 2009-08-27 07:33:29 UTC
Ok, exporting that one and running alacarte and all is running and I'm able to edit the menus and xfce sees the change.

Just how do I add that environment variable permanently.
Comment 10 Gilles Dartiguelongue (RETIRED) gentoo-dev 2009-08-27 08:54:11 UTC
That's described in gnome-menus ebuild.