Menu

#19 0.9.2 Faisl to build - Tests cause segmentation fault

None
closed
None
1
2016-11-13
2016-10-19
Jari Aalto
No

Hi,

0.9.x (both 0.9.1 and 0.9.2) build causes segmentation fault. Pleae see
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=802190

genparse fails to build from source in unstable/amd64:

[..]

../../src/genparse -l C -g -o double_clp ./double.gp
creating double_clp.h...done
creating double_clp.c...done
gcc -DHAVE_CONFIG_H -I. -I../.. -I./../../gnulib/lib -Wdate-time
-D_FORTIFY_SOURCE=2 -g -O2 -fPIE -fstack-protector-strong -Wformat
-Werror=format-security -Wall -pedantic -c double_clp.c
gcc -DHAVE_CONFIG_H -I. -I../.. -I./../../gnulib/lib -Wdate-time
-D_FORTIFY_SOURCE=2 -g -O2 -fPIE -fstack-protector-strong -Wformat
-Werror=format-security -Wall -pedantic -c double_test.c
In file included from double_test.c:23:0:
gnulib_test.h:38:33: warning: initialization from incompatible pointer
type [-Wincompatible-pointer-types]
{ "TestGenparse", NULL, NULL, test_genparse },
^
gnulib_test.h:38:33: note: (near initialization for
'suites[0].pSetUpFunc')
gcc -g -O2 -fPIE -fstack-protector-strong -Wformat
-Werror=format-security -Wall -pedantic -L../../gnulib/lib -fPIE -pie
-Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o double_test ftest.o
double_clp.o double_test.o -lcunit -lgnu -ll
make[4]: Leaving directory '/tmp/buildd/genparse-0.9.1/tests/ccheck'
make check-TESTS
make[4]: Entering directory '/tmp/buildd/genparse-0.9.1/tests/ccheck'
/bin/bash: line 5: 59539 Segmentation fault ${dir}$tst
FAIL: default_test
/bin/bash: line 5: 59544 Segmentation fault ${dir}$tst
FAIL: longmembers_test
/bin/bash: line 5: 59549 Segmentation fault ${dir}$tst
FAIL: long_test
/bin/bash: line 5: 59555 Segmentation fault ${dir}$tst
FAIL: ulong_test
/bin/bash: line 5: 59560 Segmentation fault ${dir}$tst
FAIL: intmax_test
/bin/bash: line 5: 59565 Segmentation fault ${dir}$tst
FAIL: uintmax_test
/bin/bash: line 5: 59570 Segmentation fault ${dir}$tst
FAIL: double_test
===================
7 of 7 tests failed
===================
Makefile:632: recipe for target 'check-TESTS' failed
make[4]: *** [check-TESTS] Error 1
make[4]: Leaving directory '/tmp/buildd/genparse-0.9.1/tests/ccheck'
Makefile:737: recipe for target 'check-am' failed
make[3]: *** [check-am] Error 2
make[3]: Leaving directory '/tmp/buildd/genparse-0.9.1/tests/ccheck'
Makefile:489: recipe for target 'check-recursive' failed
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory '/tmp/buildd/genparse-0.9.1/tests'
Makefile:526: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/tmp/buildd/genparse-0.9.1'
dh_auto_test: make -j1 check returned exit code 2
debian/rules:68: recipe for target 'build' failed
make: *** [build] Error 2
dpkg-buildpackage: error: debian/rules build gave error exit status 2

[..]

The full build log is attached or can be viewed here:

https://reproducible.debian.net/logs/unstable/amd64/genparse_0.9.1-1.build1.log.gz

Discussion

  • Jari Aalto

    Jari Aalto - 2016-11-09

    Followup. Fix is in attached patch.

    Anylysis: the probelm is in using old CUnit structs. CUnit used in Debian is:

        $ apt-cache policy libcunit1-dev
    
        libcunit1-dev:
          Installed: 2.1-3-dfsg-2
          Candidate: 2.1-3-dfsg-2
          Version table:
         *** 2.1-3-dfsg-2 990
                990 http://ftp.fi.debian.org/debian testing/main amd64 Packages
                500 http://ftp.fi.debian.org/debian unstable/main amd64 Packages
                100 /var/lib/dpkg/status
    

    Compiler displayed a hint about the problem:

    In file included from double_test.c:23:0:
    gnulib_test.h:38:32: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
       { "TestGenparse", NULL, NULL, test_genparse },
    

    The source code reads:

    # tests/ccheck/genparse_test.h
    
    static CU_SuiteInfo suites[] = {
      { "TestGenparse", NULL, NULL, test_genparse },
      CU_SUITE_INFO_NULL,
    };
    

    whereas the CUnit's struct definition reads:

    # /usr/include/CUnit/TestDB.h
    
    /**
    
     *  Suite parameters.
     *  This data type is provided to assist CUnit users manage collections of
     *  tests and suites.  It is intended to be used to build arrays of suite
     *  parameters that can be passed to a bulk registration function such as
     *  CU_register_suite() or CU_register_suites().
     */
    typedef struct CU_SuiteInfo {
        const char       *pName;         /**< Suite name. */
        CU_InitializeFunc pInitFunc;     /**< Suite initialization function. */
        CU_CleanupFunc    pCleanupFunc;  /**< Suite cleanup function */
        CU_SetUpFunc      pSetUpFunc;    /**< Pointer to the test SetUp function. */
        CU_TearDownFunc   pTearDownFunc; /**< Pointer to the test TearDown function. */
        CU_TestInfo      *pTests;        /**< Test case array - must be NULL terminated. */
    } CU_SuiteInfo;
    typedef CU_SuiteInfo* CU_pSuiteInfo;  /**< Pointer to CU_SuiteInfo type. */
    
    typedef void (*CU_SetUpFunc)(void);       /**< Signature for a test SetUp function. */
    
     
  • Michael Geng

    Michael Geng - 2016-11-13

    Fixed in release 0.9.3

     
  • Michael Geng

    Michael Geng - 2016-11-13
    • status: open --> closed
    • Group: -->
     
  • Michael Geng

    Michael Geng - 2016-11-13
    • assigned_to: Michael Geng
     

Log in to post a comment.

MongoDB Logo MongoDB