[Python-modules-team] Bug#903263: Bug#903263: sip-dev: segfaults building libarcus in Sid

Petter Reinholdtsen pere at hungry.com
Sun Jul 8 15:19:41 BST 2018


Control: severity -1 important

I fetched the sip source and tried to figure out what is going wrong,
and was able to get this gdb backtrace and source location:

(gdb) run -g -j 8 -c /home/pere/src/debian/3d-printing/libarcus/obj-x86_64-linux-gnu/python /home/pere/src/debian/3d-printing/libarcus/python/Socket.sip
Starting program: /home/pere/src/debian/3d-printing/sip4/build-2.7/sipgen/sip -g -j 8 -c /home/pere/src/debian/3d-printing/libarcus/obj-x86_64-linux-gnu/python /home/pere/src/debian/3d-printing/libarcus/python/Socket.sip

Program received signal SIGSEGV, Segmentation fault.
prcode (fp=fp at entry=0x5555555cbe70, fmt=0x55555559ddc7 "\");\n#else\n", 
    fmt at entry=0x55555559dd58 "    /* Get the SIP module's API. */\n#if PY_VERSION_HEX >= 0x02050000\n    sip_sipmod = PyImport_ImportModule(\"%s\");\n#else\n") at ./sipgen/gencode.c:14489
14489                       while (*cp != '\0')
(gdb) bt
#0  prcode (fp=fp at entry=0x5555555cbe70, fmt=0x55555559ddc7 "\");\n#else\n", 
    fmt at entry=0x55555559dd58 "    /* Get the SIP module's API. */\n#if PY_VERSION_HEX >= 0x02050000\n    sip_sipmod = PyImport_ImportModule(\"%s\");\n#else\n") at ./sipgen/gencode.c:14489
#1  0x00005555555734e6 in generateSipImport (mod=0x5555555cc1b0, fp=0x5555555cbe70, 
    sipName=0x0) at ./sipgen/gencode.c:2775
#2  generateCpp (pt=pt at entry=0x7fffffffe8d0, mod=<optimized out>, 
    codeDir=codeDir at entry=0x7fffffffedd3 "/home/pere/src/debian/3d-printing/libarcus/obj-x86_64-linux-gnu/python", srcSuffix=srcSuffix at entry=0x555555595866 ".cpp", parts=parts at entry=8, 
    needed_qualifiers=needed_qualifiers at entry=0x0, xsl=0x0, py_debug=0, sipName=0x0)
    at ./sipgen/gencode.c:2561
#3  0x0000555555576269 in generateCode (pt=0x7fffffffe8d0, 
    codeDir=0x7fffffffedd3 "/home/pere/src/debian/3d-printing/libarcus/obj-x86_64-linux-gnu/python", buildFile=0x0, docFile=<optimized out>, srcSuffix=0x555555595866 ".cpp", 
    except=<optimized out>, trace=0, releaseGIL=1, parts=8, needed_qualifiers=0x0, xsl=0x0, 
    consModule=0x0, docs=0, py_debug=0, sipName=0x0) at ./sipgen/gencode.c:358
#4  0x0000555555557e15 in main (argc=7, argv=0x7fffffffeb68) at ./sipgen/main.c:291
(gdb) l
14484
14485               case 's':
14486                   {
14487                       const char *cp = va_arg(ap,const char *);
14488
14489                       while (*cp != '\0')
14490                       {
14491                           if (*cp == '\n')
14492                               ++currentLineNr;
14493
(gdb)

Using this I managed to figure out that a way to avoid the segfault is
to specify '-n something' on the command line.  May I suggest sip is
extended to report a sensible error message instead of segfaulting, if
'sipName' is not set?

I'm lowering the severity to important, as there is a well known and
easy to apply fix.

-- 
Happy hacking
Petter Reinholdtsen



More information about the Python-modules-team mailing list