After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 551166 - Cannot retrieve Templates directory with g_get_user_special_dir
Cannot retrieve Templates directory with g_get_user_special_dir
Status: RESOLVED NOTGNOME
Product: glib
Classification: Platform
Component: general
2.18.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2008-09-06 22:59 UTC by Reinout van Schouwen
Modified: 2008-09-17 23:03 UTC
See Also:
GNOME target: ---
GNOME version: 2.23/2.24


Attachments
Test program in C (328 bytes, text/plain)
2008-09-15 10:38 UTC, Sebastian Pölsterl
Details
user-dirs.dirs (551 bytes, text/plain)
2008-09-17 20:43 UTC, Reinout van Schouwen
Details

Description Reinout van Schouwen 2008-09-06 22:59:59 UTC
Version: 2.23.91, Mandriva cooker

When I click the checkbox to enable the Templates module, nothing happens.
Expected result: the template module is enabled.
Comment 1 Sebastian Pölsterl 2008-09-07 08:44:52 UTC
Thanks for reporting this bug.
What exactly do you except to happen?
Comment 2 Reinout van Schouwen 2008-09-07 09:43:59 UTC
I expect that the checkbox would be checked just as with the other modules, when I try to enable them.
Comment 3 Sebastian Pölsterl 2008-09-07 13:05:27 UTC
Could you please run deskbar from the command line: /usr/lib/deskbar-applet/deskbar-applet -w -d and post the output here.
Comment 4 Reinout van Schouwen 2008-09-10 23:31:05 UTC
Here's what happens on the console when activating Templates after running the command from comment #3:

09-11 01:27:34 deskbar.core.ModuleLoader ERROR    Error while initializing Sjablonen: coercing to Unicode: need string or buffer, NoneType found
09-11 01:27:34 deskbar.core.ModuleLoader ERROR    coercing to Unicode: need string or buffer, NoneType found
Traceback (most recent call last):
  • File "/usr/lib/python2.5/site-packages/deskbar/core/ModuleLoader.py", line 179 in initialize_module
    module.initialize ()
  • File "/usr/lib/deskbar-applet/modules-2.20-compatible/templates.py", line 193 in initialize
    for f in os.listdir(templates_dir):
TypeError: coercing to Unicode: need string or buffer, NoneType found

(deskbar-applet:2514): Bonobo-WARNING **: Never got frame, control died - abnormal exit condition

(deskbar-applet:2514): Bonobo-WARNING **: Never got frame, control died - abnormal exit condition
Comment 5 Sebastian Pölsterl 2008-09-11 15:49:20 UTC
The bug appears because you don't have a templates directory. It's now fixed in svn trunk.
Comment 6 Reinout van Schouwen 2008-09-11 21:37:43 UTC
Actually, I _do_ have a Templates directory (and yes, I've checked that it is writable). There must be something more behind this.
Comment 7 Sebastian Pölsterl 2008-09-13 09:01:24 UTC
Ok. I committed changes to svn trunk that should tell exactly what's wrong when an error occured. Could you please try it with the latest version from svn trunk?
Comment 8 Reinout van Schouwen 2008-09-14 21:18:13 UTC
Here you go:

09-14 22:42:32 deskbar.core.ModuleLoader ERROR    Error while initializing Templates: Argument out of range
09-14 22:42:32 deskbar.core.ModuleLoader ERROR    Argument out of range
Traceback (most recent call last):
  • File "/home/reinout/devel/deskbar-applet/deskbar/core/ModuleLoader.py", line 179 in initialize_module
    module.initialize ()
  • File "/home/reinout/devel/deskbar-applet/deskbar/handlers/templates.py", line 192 in initialize
    templates_dir = deskbar.core.Utils.get_xdg_user_dir(deskbar.core.Utils.DIRECTORY_TEMPLATES)
ValueError: Argument out of range

The error apparently originates from __userdirsmodule.c:42, but looking at the code, I just can't see why g_get_user_special_dir would return NULL.
Comment 9 Sebastian Pölsterl 2008-09-15 10:38:54 UTC
Created attachment 118732 [details]
Test program in C

Weird. What's your glib version?

Could please try what the program I attached prints. Compile it with gcc -o test-templates-dir `pkg-config --libs --cflags glib-2.0` test-templates-dir.c
Comment 10 Reinout van Schouwen 2008-09-15 22:25:03 UTC
glib version is libglib2.0_0-2.18.0-1mdv2009.0

$ ./test-templates-dir 
Error: directory 6 is unknown

Apparently the code is looking for a directory named as the int value of the constant instead of the corresponding user directory?!
Comment 11 Sebastian Pölsterl 2008-09-16 02:41:54 UTC
6 is just the value of the enum value G_USER_DIRECTORY_TEMPLATES. That's okay.

It seems very much like a bug in glib to me, therefore I re-assign this issue to the glib team.
Comment 12 Matthias Clasen 2008-09-16 19:19:28 UTC
Can you attach your ~/.config/user-dirs.dirs ?
Comment 13 Reinout van Schouwen 2008-09-17 20:43:48 UTC
Created attachment 118905 [details]
user-dirs.dirs

Obviously, the Templates folder isn't mentioned in this file.
Comment 14 Reinout van Schouwen 2008-09-17 22:09:30 UTC
Turns out that there's a Mandriva specific patch probably causing this.

http://svn.mandriva.com/svn/packages/cooker/xdg-user-dirs/current/SOURCES/xdg-user-dirs-0.8-mdv.patch