failed unit test: sal_osl_file

Terrence Enger tenger at iseries-guru.com
Wed May 9 14:17:41 PDT 2012


I am trying to build master commit id 5c2c0e3, pulled 2012-05-08, on
ubuntu-natty (11.04), and it is failing in unit test sal_osl_file.

An excerpt from the terminal output from `make sal` is in attachment
20120509c.  I think the bad address passed to free() is just a
secondary error, right?  Is it of interest on its own account?


A backtrace from gdb is in attachment 20120509d.  I think I see the
following ...

(*) sal/inc/osl/file.hxx line 1645 sets Directory._pData to 0

    ( Directory::isOpen(), defined at line 1691 of the same file, and
    Directory::close(), particularly line 1712 of the same file,
    suggest that _pData equal NULL is the normal state for a closed
    Directory. )

(*) qa/osl/file/osl_File.cxx line 5562 applies that to testDirectory
    and in particular to testDirectory._pData.

(*) the same file, line 5563, frame 19 in the gdb backtrace, invokes
    Directory::getNextItem on testDirectory.

(*) sal/inc/osl/file.hxx line 1772, frame 18 in the gdb backtrace,
    passes that zero as parameter 1 to osl_getNextDirectoryItem.

(*) sal/osl/unx/file_misc.cxx line 321, frame 17 in the gdb backtrace,
    asserts that parameter 1 of osl_getNextDirectoryItem is non zero,
    and we are doomed to failure.


So, I ask ...

(*) Am I reading the code correctly?

(*) If so, how could this unit test have ever come close to working?

(*) What should I do?

(*) The presence of same-named data members _pData in related classes
    FileBase, Directory, and DirectoryItem is a normal programming
    convention.  I should just get over my confusion.  Right?

(*) Those three data members _pData are of three different types, each
    typedef'd to `void *`.  So the compiler will not diagnose the use
    of one where another was intended.  This is not something to be
    fixed.  Right?


Thank you for your help.
Terry.

-------------- next part --------------
[ build CUT ] sal_osl_file
*** glibc detected *** /home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester: free(): invalid pointer: 0x400877e4 ***
======= Backtrace: =========
/lib/i386-linux-gnu/libc.so.6(+0x6cbe1)[0x40324be1]
/lib/i386-linux-gnu/libc.so.6(+0x6e50b)[0x4032650b]
/lib/i386-linux-gnu/libc.so.6(cfree+0x6d)[0x4032969d]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6(_ZdlPv+0x21)[0x4021c4d1]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN9__gnu_cxx13new_allocatorIcE10deallocateEPcj+0x1d)[0x400fd16f]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZNSs4_Rep10_M_destroyERKSaIcE+0x4b)[0x400fcf9f]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6(_ZNSt15basic_stringbufIcSt11char_traitsIcESaIcEE8overflowEi+0x16f)[0x401f83bf]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6(_ZNSt15basic_streambufIcSt11char_traitsIcEE6xsputnEPKci+0x3d)[0x401fc8fd]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6(_ZSt16__ostream_insertIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_PKS3_i+0x1ba)[0x401f25ba]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6(_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc+0x3c)[0x401f285c]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3(+0x1a168)[0x4003b168]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3(+0x1a2d5)[0x4003b2d5]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3(sal_detail_logFormat+0x2c)[0x4003b31d]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3(osl_getNextDirectoryItem+0x4e)[0x4005d8e8]
/home/terry/lo_hacking/git/libo/workdir/unxlngi6/LinkTarget/CppunitTest/libtest_sal_osl_file.so(+0x7e6a)[0x40993e6a]
/home/terry/lo_hacking/git/libo/workdir/unxlngi6/LinkTarget/CppunitTest/libtest_sal_osl_file.so(+0x3b2aa)[0x409c72aa]
/home/terry/lo_hacking/git/libo/workdir/unxlngi6/LinkTarget/CppunitTest/libtest_sal_osl_file.so(+0xdce1)[0x40999ce1]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZNK7CppUnit21TestCaseMethodFunctorclEv+0x4e)[0x401170f6]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit16DefaultProtector7protectERKNS_7FunctorERKNS_16ProtectorContextE+0x28)[0x401005e6]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZNK7CppUnit14ProtectorChain14ProtectFunctorclEv+0x33)[0x4010f2a1]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit14ProtectorChain7protectERKNS_7FunctorERKNS_16ProtectorContextE+0x132)[0x4010f170]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit10TestResult7protectERKNS_7FunctorEPNS_4TestERKSs+0x59)[0x40125845]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit8TestCase3runEPNS_10TestResultE+0x152)[0x40116c26]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit13TestComposite15doRunChildTestsEPNS_10TestResultE+0x66)[0x401178dc]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit13TestComposite3runEPNS_10TestResultE+0x38)[0x40117796]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit13TestComposite15doRunChildTestsEPNS_10TestResultE+0x66)[0x401178dc]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit13TestComposite3runEPNS_10TestResultE+0x38)[0x40117796]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit10TestRunner13WrappingSuite3runEPNS_10TestResultE+0x3f)[0x4012c915]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit10TestResult7runTestEPNS_4TestE+0x38)[0x401255c4]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1(_ZN7CppUnit10TestRunner3runERNS_10TestResultERKSs+0x65)[0x4012cb69]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester[0x804a7cd]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester[0x804ac6b]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xe7)[0x402cee37]
/home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester[0x804a3e1]
======= Memory map: ========
08048000-08050000 r-xp 00000000 08:03 1786703    /home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester
08050000-08051000 r--p 00007000 08:03 1786703    /home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester
08051000-08052000 rw-p 00008000 08:03 1786703    /home/terry/lo_hacking/git/libo/solver/unxlngi6/bin/cppunit/cppunittester
09b16000-09b37000 rw-p 00000000 00:00 0          [heap]
40000000-4001c000 r-xp 00000000 08:01 426397     /lib/i386-linux-gnu/ld-2.13.so
4001c000-4001d000 r--p 0001b000 08:01 426397     /lib/i386-linux-gnu/ld-2.13.so
4001d000-4001e000 rw-p 0001c000 08:01 426397     /lib/i386-linux-gnu/ld-2.13.so
4001e000-4001f000 r-xp 00000000 00:00 0          [vdso]
4001f000-40021000 rw-p 00000000 00:00 0 
40021000-40085000 r-xp 00000000 08:03 1092770    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3
40085000-40087000 r--p 00063000 08:03 1092770    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3
40087000-40088000 rw-p 00065000 08:03 1092770    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libuno_sal.so.3
40088000-4008d000 rw-p 00000000 00:00 0 
4008d000-4016d000 r-xp 00000000 08:03 1092733    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
4016d000-4016f000 r--p 000df000 08:03 1092733    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
4016f000-40172000 rw-p 000e1000 08:03 1092733    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
40172000-40251000 r-xp 00000000 08:03 1092765    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
40251000-40255000 r--p 000de000 08:03 1092765    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
40255000-40256000 rw-p 000e2000 08:03 1092765    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
40256000-4026d000 rw-p 00000000 00:00 0 
40276000-4029a000 r-xp 00000000 08:01 426404     /lib/i386-linux-gnu/libm-2.13.so
4029a000-4029b000 r--p 00023000 08:01 426404     /lib/i386-linux-gnu/libm-2.13.so
4029b000-4029c000 rw-p 00024000 08:01 426404     /lib/i386-linux-gnu/libm-2.13.so
4029c000-402b6000 r-xp 00000000 08:03 1092764    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libgcc_s.so.1
402b6000-402b7000 r--p 00019000 08:03 1092764    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libgcc_s.so.1
402b7000-402b8000 rw-p 0001a000 08:03 1092764    /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libgcc_s.so.1
402b8000-40414000 r-xp 00000000 08:01 426400     /lib/i386-linux-gnu/libc-2.13.so
40414000-40416000 r--p 0015c000 08:01 426400     /lib/i386-linux-gnu/libc-2.13.so
40416000-40417000 rw-p 0015e000 08:01 426400     /lib/i386-linux-gnu/libc-2.13.so
40417000-4041b000 rw-p 00000000 00:00 0 Aborted
-------------- next part --------------
#0  0x4001e416 in __kernel_vsyscall ()
#1  0x402e2e71 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x402e634e in abort () at abort.c:92
#3  0x4031a7f7 in __libc_message (do_abort=2, 
    fmt=0x403f3c0c "*** glibc detected *** %s: %s: 0x%s ***\n")
    at ../sysdeps/unix/sysv/linux/libc_fatal.c:189
#4  0x40324be1 in malloc_printerr (action=<value optimized out>, 
    str=<value optimized out>, ptr=0x400877e4) at malloc.c:6283
#5  0x4032650b in _int_free (av=<value optimized out>, p=0x400877dc)
    at malloc.c:4795
#6  0x4032969d in __libc_free (mem=0x400877e4) at malloc.c:3738
#7  0x4021c4d1 in operator delete(void*) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
#8  0x400fd16f in __gnu_cxx::new_allocator<char>::deallocate(char*, unsigned int) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#9  0x400fcf9f in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Rep::_M_destroy(std::allocator<char> const&) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#10 0x401f83bf in std::basic_stringbuf<char, std::char_traits<char>, std::allocator<char> >::overflow(int) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
#11 0x401fc8fd in std::basic_streambuf<char, std::char_traits<char> >::xsputn(char const*, int) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
#12 0x401f25ba in std::basic_ostream<char, std::char_traits<char> >& std::__ostream_insert<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*, int) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
#13 0x401f285c in std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libstdc++.so.6
#14 0x4003b168 in (anonymous namespace)::log (level=SAL_DETAIL_LOG_LEVEL_WARN, 
    area=0x40063f8c "legacy.osl", 
    where=0x400733ea "/home/terry/lo_hacking/git/libo/sal/osl/unx/file_misc.cxx:321: ", message=0xbfff9fbc "OSL_ASSERT: Directory")
    at /home/terry/lo_hacking/git/libo/sal/osl/all/log.cxx:162
#15 0x4003b2d5 in osl::detail::logFormat (level=SAL_DETAIL_LOG_LEVEL_WARN, 
    area=0x40063f8c "legacy.osl", 
    where=0x400733ea "/home/terry/lo_hacking/git/libo/sal/osl/unx/file_misc.cxx:321: ", format=0x40063f44 "OSL_ASSERT: %s", 
    arguments=0xbfffa420 "\240\063\a@\364\357\026 at h\244\377\277\250\330\005@\200\312D@\200-\005\bH\244\377\277\006y9 at h\313D@\364o\b@")
    at /home/terry/lo_hacking/git/libo/sal/osl/all/log.cxx:204
#16 0x4003b31d in sal_detail_logFormat (level=SAL_DETAIL_LOG_LEVEL_WARN, 
    area=0x40063f8c "legacy.osl", 
    where=0x400733ea "/home/terry/lo_hacking/git/libo/sal/osl/unx/file_misc.cxx:321: ", format=0x40063f44 "OSL_ASSERT: %s")
    at /home/terry/lo_hacking/git/libo/sal/osl/all/log.cxx:187
#17 0x4005d8e8 in osl_getNextDirectoryItem (Directory=0x0, pItem=0x8054cf4)
    at /home/terry/lo_hacking/git/libo/sal/osl/unx/file_misc.cxx:321
#18 0x40993e6a in osl::Directory::getNextItem (rItem=..., nHint=0, 
    this=<value optimized out>)
    at /home/terry/lo_hacking/git/libo/solver/unxlngi6/inc/osl/file.hxx:1772
#19 0x409c72aa in osl_Directory::getNextItem::getNextItem_002 (this=0x8054ce8)
    at /home/terry/lo_hacking/git/libo/sal/qa/osl/file/osl_File.cxx:5563
#20 0x40999ce1 in CppUnit::TestCaller<osl_Directory::getNextItem>::runTest (
    this=0x8054d00)
    at /home/terry/lo_hacking/git/libo/solver/unxlngi6/inc/cppunit/TestCaller.h:166
#21 0x401170f6 in CppUnit::TestCaseMethodFunctor::operator()() const ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#22 0x401005e6 in CppUnit::DefaultProtector::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#23 0x4010f2a1 in CppUnit::ProtectorChain::ProtectFunctor::operator()() const
    ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#24 0x4010f170 in CppUnit::ProtectorChain::protect(CppUnit::Functor const&, CppUnit::ProtectorContext const&) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#25 0x40125845 in CppUnit::TestResult::protect(CppUnit::Functor const&, CppUnit::Test*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#26 0x40116c26 in CppUnit::TestCase::run(CppUnit::TestResult*) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#27 0x401178dc in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*)
    ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#28 0x40117796 in CppUnit::TestComposite::run(CppUnit::TestResult*) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#29 0x401178dc in CppUnit::TestComposite::doRunChildTests(CppUnit::TestResult*)
    ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#30 0x40117796 in CppUnit::TestComposite::run(CppUnit::TestResult*) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#31 0x4012c915 in CppUnit::TestRunner::WrappingSuite::run(CppUnit::TestResult*)
    ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#32 0x401255c4 in CppUnit::TestResult::runTest(CppUnit::Test*) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#33 0x4012cb69 in CppUnit::TestRunner::run(CppUnit::TestResult&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
   from /home/terry/lo_hacking/git/libo/solver/unxlngi6/lib/libcppunit-1.12.so.1
#34 0x0804a7cd in (anonymous namespace)::ProtectedFixtureFunctor::run (
    this=0xbfffaab0)
    at /home/terry/lo_hacking/git/libo/sal/cppunittester/cppunittester.cxx:158
#35 0x0804ac6b in sal_main (argc=Cannot access memory at address 0x2534
)
    at /home/terry/lo_hacking/git/libo/sal/cppunittester/cppunittester.cxx:248
#36 main (argc=Cannot access memory at address 0x2534
)
    at /home/terry/lo_hacking/git/libo/sal/cppunittester/cppunittester.cxx:174


More information about the LibreOffice mailing list