sigsev when printing ldb object

Matthieu Patou mat+Informatique.Samba at matws.net
Wed Apr 7 10:28:18 MDT 2010


Hello jelmer,

I was debuging upgradeprovision today when I find this:

@ATTRIBUTES
('dn', Dn('@ATTRIBUTES'))

Program received signal SIGSEGV, Segmentation fault.
strlen () at ../sysdeps/i386/i486/strlen.S:69
69    ../sysdeps/i386/i486/strlen.S: Aucun fichier ou dossier de ce type.
     in ../sysdeps/i386/i486/strlen.S
Current language:  auto
The current source language is "auto; currently asm".
(gdb) bt
#0  strlen () at ../sysdeps/i386/i486/strlen.S:69
#1  0x080a0e5a in PyString_FromFormatV ()
#2  0x080a1008 in PyString_FromFormat ()
#3  0xb753b18c in py_ldb_msg_element_repr (self=0x9dc1620) at 
lib/ldb/pyldb.c:1830
#4  0x08092bd5 in PyObject_Repr ()
#5  0x08093130 in ?? ()
#6  0x080a5ed3 in ?? ()
#7  0x08093074 in ?? ()
#8  0x08073d62 in PyFile_WriteObject ()
#9  0x080dacaa in PyEval_EvalFrameEx ()
#10 0x080dd384 in PyEval_EvalFrameEx ()
#11 0x080dddf2 in PyEval_EvalCodeEx ()
#12 0x080ddef7 in PyEval_EvalCode ()
#13 0x080faa1f in PyRun_FileExFlags ()
#14 0x080fac12 in PyRun_SimpleFileExFlags ()
#15 0x0805c8d8 in Py_Main ()
#16 0x0805baeb in main ()
(gdb) frame 3

Looking at the code :
        element_str = NULL;
....
         for (i = 0; i < el->num_values; i++) {
                 PyObject *o = py_ldb_msg_element_find(self, i);
                 if (element_str == NULL)
                         element_str = talloc_strdup(NULL, 
PyObject_REPR(o));
                 else
                         element_str = 
talloc_asprintf_append(element_str, ",%s", PyObject_REPR(o));
         }

         ret = PyString_FromFormat("MessageElement([%s])", element_str);

I have the impression that there was no element in my MessageElement ... 
(I got it from a ldb_msg_diff) and so it fails. Is the solution to add a 
final test with if not NULL then do the pystring + talloc free else 
pystring of "MessageElement([Empty])".
?

Matthieu.


More information about the samba-technical mailing list