Archive: [POSIX] [CVS] test failure - double free


[POSIX] [CVS] test failure - double free
I got the following failure with today's CVS. I'm not sure, but the test code is so simple that this makes me think this is a cppunit bug. Any ideas?

$ gdb build/release/tests/test
GNU gdb 6.3.90_20051119-debian
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i486-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/pabs/devel/debian/misc/nsis/NSIS/build/release/tests/test
*** glibc detected *** free(): invalid pointer: 0x08059388 ***

Program received signal SIGABRT, Aborted.
0xb7cb47a7 in raise () from /lib/tls/libc.so.6
(gdb) bt
#0 0xb7cb47a7 in raise () from /lib/tls/libc.so.6
#1 0xb7cb604b in abort () from /lib/tls/libc.so.6
#2 0xb7ceb005 in __fsetlocking () from /lib/tls/libc.so.6
#3 0xb7cf1657 in malloc_usable_size () from /lib/tls/libc.so.6
#4 0xb7cf1af2 in free () from /lib/tls/libc.so.6
#5 0xb7e9e7c1 in operator delete () from /usr/lib/libstdc++.so.6
#6 0x0804bfe3 in __gnu_cxx::new_allocator<std::string*>::deallocate (this=0xbfb60607, __p=0x8059388) at new_allocator.h:94
#7 0x0804c124 in std::_Deque_base<std::string, std::allocator<std::string> >::_M_deallocate_map (this=0xbfb60684, __p=0x8059388, __n=8) at stl_deque.h:411
#8 0x0804c17e in ~_Deque_base (this=0xbfb60684) at stl_deque.h:430
#9 0xb7f03ec3 in CppUnit::TestPath::TestPath () from /usr/lib/libcppunit-1.10.so.2
#10 0xb7efb433 in CppUnit::Test::resolveTestPath () from /usr/lib/libcppunit-1.10.so.2
#11 0xb7f0fe5c in CppUnit::TestRunner::run () from /usr/lib/libcppunit-1.10.so.2
#12 0xb7f1511b in CppUnit::TextTestRunner::run () from /usr/lib/libcppunit-1.10.so.2
#13 0x0805069b in main (argc=1, argv=0xbfb608f4) at Source/Tests/textrunner.cpp:18
I got this with vanilla CVS and with the POSIX install patch (new version soon).

All of the stack entries are outside of the tests code. Did it even reach some of test code?


Correct, the tests are not being called. I wonder if this is a toolchain issue perhaps - symbol naming change or something. Any suggestions for tracking down why the tests are not called?

Edit: it probably has something to do with this: http://bugs.debian.org/339158 (libstdc++ allocator change). There is a new version available for that, so I'll wait until that is available and try again.


On another related issue, the endian test fails on m68k:

/build/buildd/nsis-2.11/build/release/tests/test
..F..

endian.cpp:31:Assertion
Test name: EndianTest::testFixEndian
equality assertion failed
- Expected: 2018915346 (0x78563412)
- Actual : 305419896 (0x12345678)

Failures !!!
Run: 4 Failure total: 1 Failures: 1 Errors: 0
scons: *** [test-code] Error 1
Full logs are available here:
http://experimental.debian.net/fetch...ile=log&as=raw

I don't have access to any m68k machines yet, but I might be able to get my sponsor to find the problem, or get access to one later. Looking at the code I don't understand why it fails.

Explanation of the endianness problem: util.h wasn't detecting the endianness correctly when defining FIX_ENDIAN_INT32_INPLACE. On linux you detect this by including endian.h and testing if BYTE_ORDER == LITTLE_ENDIAN. I'm not sure how portable this is, so there is no proper patch yet. A quick grep reveals a few places test for __BIG_ENDIAN__, most of them are not relevant because they are in code that is compiled using the Win32 cross compiler.

http://lists.debian.org/debian-68k/2.../msg00043.html
http://lists.debian.org/debian-68k/2.../msg00045.html

Ugh, shouldn't have posted that question at 3am :/