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 581082 - segfault with new glib.get_user_special_dir
segfault with new glib.get_user_special_dir
Status: RESOLVED FIXED
Product: pygobject
Classification: Bindings
Component: gobject
2.17.x
Other Linux
: Normal major
: ---
Assigned To: Nobody's working on this now (help wanted and appreciated)
Python bindings maintainers
Depends on:
Blocks:
 
 
Reported: 2009-05-02 08:54 UTC by Christian Fredrik Kalager Schaller
Modified: 2009-05-03 12:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
potential fix (931 bytes, patch)
2009-05-02 21:00 UTC, Paul Pogonyshev
committed Details | Review

Description Christian Fredrik Kalager Schaller 2009-05-02 08:54:44 UTC
I hope this is not me just being a newbie, but I am trying to use the new special dir wrapping in pygobject 2.17.0. I am using the code below, but instead of printing the directory name, I get a segfault. I can attached a backtrace, but I am assuming that this is either easily reproducible or me using the API wrongly.

bob = glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC)
print bob
Comment 1 Gian Mario Tagliaretti 2009-05-02 10:22:44 UTC
gianmt@urano:~$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import glib
>>> bob = glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC)
>>> print bob
/home/gianmt/Music
>>> 
Comment 2 Gian Mario Tagliaretti 2009-05-02 10:24:00 UTC
oh well, forgot to mention

>>> glib.glib_version
(2, 20, 1)
>>> glib.pyglib_version
(2, 17, 0)
>>> 
Comment 3 Christian Fredrik Kalager Schaller 2009-05-02 11:09:06 UTC
I originally had a lower version glib, but I upgraded before filing this bug report and I have the exact same versions as you. 

>>> import glib
>>> bob = glib.get_user_special_dir(glib.USER_DIRECTORY_MUSIC)
Segmentation fault
[cschalle@crazyhorse devel]$

I am using Fedora and I have python version 2.5.2

The gdb backtrace is this:

Starting program: /usr/bin/python xdgdir.py
[Thread debugging using libthread_db enabled]
[New Thread 0xb7fe26c0 (LWP 5946)]

Program received signal SIGSEGV, Segmentation fault.
0x04803ee5 in _PyArg_ParseTupleAndKeywords_SizeT (args=0xb7fcc66c, 
    keywords=0x5ed5f40, format=0x4add13 "i:glib.get_user_special_dir", 
    kwlist=0x4b1618) at Python/getargs.c:1266
1266		if ((args == NULL || !PyTuple_Check(args)) ||
(gdb) thread apply all bt

Thread 1 (Thread 0xb7fe26c0 (LWP 5946))

  • #0 _PyArg_ParseTupleAndKeywords_SizeT
    at Python/getargs.c line 1266
  • #1 pyglib_get_user_special_dir
    at glibmodule.c line 455
  • #2 PyCFunction_Call
    at Objects/methodobject.c line 73
  • #3 call_function
    at Python/ceval.c line 3573
  • #4 PyEval_EvalFrameEx
    at Python/ceval.c line 2272
  • #5 PyEval_EvalCodeEx
    at Python/ceval.c line 2836
  • #6 PyEval_EvalCode
    at Python/ceval.c line 494
  • #7 run_mod
    at Python/pythonrun.c line 1273
  • #8 PyRun_FileExFlags
    at Python/pythonrun.c line 1259
  • #9 PyRun_SimpleFileExFlags
    at Python/pythonrun.c line 879
  • #10 PyRun_AnyFileExFlags
    at Python/pythonrun.c line 698
  • #11 Py_Main
    at Modules/main.c line 523
  • #12 main
    at Modules/python.c line 23

Comment 4 Paul Pogonyshev 2009-05-02 21:00:09 UTC
Created attachment 133829 [details] [review]
potential fix

I couldn't reproduce the bug, but I found something suspicious about the code.  Can you test if this one-liner fixes the crash?
Comment 5 Christian Fredrik Kalager Schaller 2009-05-03 10:25:35 UTC
Hi Paul,
Thanks a lot for the quick fix. This patch fixes it for me.

Christian