Segfault when calling MTP.get_filelisting()

Bug #1218162 reported by Viktor Suprun
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
pymtp (Debian)
Fix Released
Unknown
pymtp (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

Extra info:
$ lsb_release -rd
Description: Ubuntu 13.04
Release: 13.04

$ apt-cache policy python-pymtp
python-pymtp:
  Установлен: 0.0.4-4
  Кандидат: 0.0.4-4
  Таблица версий:
 *** 0.0.4-4 0
        500 http://mirror.yandex.ru/ubuntu/ raring/universe amd64 Packages
        100 /var/lib/dpkg/status

The following code causes crash:
import pymtp
m = pymtp.MTP()
m.connect()
m.get_filelisting()

GDB data:
$ gdb python
*** stripped ***
Reading symbols from /usr/bin/python2.7...Reading symbols from /usr/lib/debug/usr/bin/python2.7...done.
done.
(gdb) r
Starting program: /usr/bin/python2.7
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 2.7.4 (default, Jul 5 2013, 08:21:57)
[GCC 4.7.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymtp
>>> m = pymtp.MTP()
Unable to open ~/.mtpz-data for reading, MTPZ disabled.>>>
>>> m.connect()
Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP).
LIBMTP panic: unable to read in zero packet, response 0xfffffff8>>>
>>> m.get_devicename()
'GT-I9300'
>>> m.get_filelisting()

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff624e2e4 in Pointer_nonzero.2726 (self=0x7ffff7e1b0e0) at /build/buildd/python2.7-2.7.4/Modules/_ctypes/_ctypes.c:5268
5268 /build/buildd/python2.7-2.7.4/Modules/_ctypes/_ctypes.c: Нет такого файла или каталога.
(gdb) ba
#0 0x00007ffff624e2e4 in Pointer_nonzero.2726 (self=0x7ffff7e1b0e0) at /build/buildd/python2.7-2.7.4/Modules/_ctypes/_ctypes.c:5268
#1 0x000000000047933d in PyObject_IsTrue.part.3 (v=<LP_LIBMTP_File at remote 0x7ffff7e1b0e0>) at ../Objects/object.c:1578
#2 PyObject_IsTrue (v=<LP_LIBMTP_File at remote 0x7ffff7e1b0e0>) at ../Python/ceval.c:687
#3 PyEval_EvalFrameEx (
    f=f@entry=Frame 0xa7e990, for file /usr/lib/pymodules/python2.7/pymtp.py, line 594, in get_filelisting (self=<MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CDLL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e5694...(truncated), throwflag=throwflag@entry=0) at ../Python/ceval.c:2383
#4 0x00000000004e010a in PyEval_EvalCodeEx (co=0x7ffff7ecc730, globals=<optimized out>, locals=locals@entry=0x0, args=<optimized out>,
    argcount=argcount@entry=1, kws=0xa7e960, kwcount=0, defs=defs@entry=0x7ffff7e8b3e8, defcount=1, closure=0x0) at ../Python/ceval.c:3253
#5 0x0000000000476204 in fast_function (nk=<optimized out>, na=1, n=<optimized out>, pp_stack=0x7fffffffdb40,
    func=<function at remote 0x7ffff7e17758>) at ../Python/ceval.c:4117
#6 call_function (oparg=<optimized out>, pp_stack=0x7fffffffdb40) at ../Python/ceval.c:4042
#7 PyEval_EvalFrameEx (f=f@entry=Frame 0xa7e7e0, for file <stdin>, line 1, in <module> (), throwflag=throwflag@entry=0) at ../Python/ceval.c:2666
#8 0x00000000004e010a in PyEval_EvalCodeEx (co=co@entry=0x7ffff7eac230,
    globals=globals@entry={'__builtins__': <module at remote 0x7ffff7f8ab08>, 'm': <MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CDLL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e56940>, LIBMTP_Find_Folder=<_FuncPtr(__name__=...(truncated),
    locals=locals@entry={'__builtins__': <module at remote 0x7ffff7f8ab08>, 'm': <MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CDLL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e56940>, LIBMTP_Find_Folder=<_FuncPtr(__name__=...(truncated), args=args@entry=0x0, argcount=argcount@entry=0, kws=kws@entry=0x0, kwcount=kwcount@entry=0, defs=defs@entry=0x0,
    defcount=defcount@entry=0, closure=closure@entry=0x0) at ../Python/ceval.c:3253
#9 0x000000000053f972 in PyEval_EvalCode (co=co@entry=0x7ffff7eac230,
    globals=globals@entry={'__builtins__': <module at remote 0x7ffff7f8ab08>, 'm': <MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CD---Type <return> to continue, or q <return> to quit---
LL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e56940>, LIBMTP_Find_Folder=<_FuncPtr(__name__=...(truncated),
    locals=locals@entry={'__builtins__': <module at remote 0x7ffff7f8ab08>, 'm': <MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CDLL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e56940>, LIBMTP_Find_Folder=<_FuncPtr(__name__=...(truncated)) at ../Python/ceval.c:667
#10 0x000000000053fdeb in run_mod.42827 (mod=mod@entry=0x9b7008, filename=filename@entry=0x545469 "<stdin>",
    globals={'__builtins__': <module at remote 0x7ffff7f8ab08>, 'm': <MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CDLL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e56940>, LIBMTP_Find_Folder=<_FuncPtr(__name__=...(truncated),
    locals={'__builtins__': <module at remote 0x7ffff7f8ab08>, 'm': <MTP(device=<LP_LIBMTP_MTPDevice at remote 0x7ffff7e18d40>, mtp=<CDLL(_FuncPtr=<_ctypes.PyCFuncPtrType at remote 0x9e89c0>, LIBMTP_Get_Tracklisting_With_Callback=<_FuncPtr(__name__='LIBMTP_Get_Tracklisting_With_Callback') at remote 0x7ffff7e56ae0>, LIBMTP_Get_Friendlyname=<_FuncPtr(__name__='LIBMTP_Get_Friendlyname') at remote 0x7ffff7e56600>, LIBMTP_Get_Playlist=<_FuncPtr(__name__='LIBMTP_Get_Playlist') at remote 0x7ffff7e19050>, LIBMTP_Get_Modelname=<_FuncPtr(__name__='LIBMTP_Get_Modelname') at remote 0x7ffff7e567a0>, LIBMTP_Get_Errorstack=<_FuncPtr(__name__='LIBMTP_Get_Errorstack') at remote 0x7ffff7e192c0>, LIBMTP_Get_Trackmetadata=<_FuncPtr(__name__='LIBMTP_Get_Trackmetadata') at remote 0x7ffff7e56d50>, _handle=10207472, _name='libmtp.so.9', LIBMTP_Init=<_FuncPtr(__name__='LIBMTP_Init') at remote 0x7ffff7e19390>, LIBMTP_Get_Deviceversion=<_FuncPtr(__name__='LIBMTP_Get_Deviceversion') at remote 0x7ffff7e56940>, LIBMTP_Find_Folder=<_FuncPtr(__name__=...(truncated),
    flags=flags@entry=0x7fffffffddc0, arena=arena@entry=0x99ff90) at ../Python/pythonrun.c:1365
#11 0x0000000000465735 in PyRun_InteractiveOneFlags (fp=fp@entry=0x7ffff7294360 <_IO_2_1_stdin_>, filename=filename@entry=0x545469 "<stdin>",
    flags=flags@entry=0x7fffffffddc0) at ../Python/pythonrun.c:852
#12 0x0000000000465828 in PyRun_InteractiveLoopFlags (fp=fp@entry=0x7ffff7294360 <_IO_2_1_stdin_>, filename=filename@entry=0x545469 "<stdin>",
    flags=flags@entry=0x7fffffffddc0) at ../Python/pythonrun.c:772
#13 0x0000000000465eb2 in PyRun_AnyFileExFlags (fp=fp@entry=0x7ffff7294360 <_IO_2_1_stdin_>, filename=filename@entry=0x545469 "<stdin>",
    closeit=closeit@entry=0, flags=flags@entry=0x7fffffffddc0) at ../Python/pythonrun.c:741
---Type <return> to continue, or q <return> to quit---
#14 0x0000000000466b78 in Py_Main (argc=<optimized out>, argv=0x7fffffffdf78) at ../Modules/main.c:640
#15 0x00007ffff6ef3ea5 in __libc_start_main () from /lib/x86_64-linux-gnu/libc.so.6
#16 0x00000000004e0d95 in _start ()

Tags: raring
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in pymtp (Ubuntu):
status: New → Confirmed
Revision history for this message
Hans-Christoph Steiner (eighthave) wrote :

I believe this is fixed in Debian with package 0.0.6-1 currently in unstable.

Revision history for this message
Hans-Christoph Steiner (eighthave) wrote :

I should add: my guess is that the problem is caused by pymtp being out of sync with the libmtp API. pymtp is a ctypes wrapper of libmtp, so its structs need to match libmtps, or there will be crashes.

Changed in pymtp (Debian):
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.