Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-30 Thread Nigel Hawkins
On Wed, 2011-06-29 at 23:26 +0200, Julien Nabet wrote:
 diff --git a/sal/qa/osl/process/osl_process.cxx 
 b/sal/qa/osl/process/osl_process.cxx
 index 2535c4c..8695d79 100644
 --- a/sal/qa/osl/process/osl_process.cxx
 +++ b/sal/qa/osl/process/osl_process.cxx
 @@ -477,6 +477,7 @@ public:
   );
 
   std::string line;
 +   line.reserve(1);
   while (std::getline(file, line, '\0'))
   env_container-push_back(line);
   tidy_container(*env_container);

That change fixes the problem here.

Nigel

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-29 Thread Julien Nabet

Hello,

I tried the patch attached. In fact, I remarked by reading some forums 
(sorry i don't remember the specific link I read) that getline could 
need some extra precaution. I don't know if this patch is correct but 
there's no more memory error. However there's now an assertion failure 
because number of env vars is different from number children env vars.


Julien.
diff --git a/sal/qa/osl/process/osl_process.cxx 
b/sal/qa/osl/process/osl_process.cxx
index 2535c4c..e5f53c7 100644
--- a/sal/qa/osl/process/osl_process.cxx
+++ b/sal/qa/osl/process/osl_process.cxx
@@ -60,6 +60,7 @@
 #include algorithm
 #include iterator
 #include string
+#include limits
 
 #ifdef UNX
 #if defined( MACOSX )
@@ -469,7 +470,7 @@ public:
 OString temp_file_name = OUStringToOString(OUString(
 parameters_[1]), osl_getThreadTextEncoding());
 std::ifstream file(temp_file_name.getStr());
-
+file.ignore(std::numeric_limitsstd::streamsize::max(), '\n');
 CPPUNIT_ASSERT_MESSAGE
 (
 I/O error, cannot open child environment file,
@@ -561,8 +562,13 @@ public:
 #endif
 
 bool different_env_size_equals= (different_child_env_vars.size() 
== different_env_vars.size());
-bool different_env_content_equals =
+fprintf(stderr, different_child_env_vars.size() %d\n, 
different_child_env_vars.size());fflush(stderr);
+fprintf(stderr, different_env_vars.size() %d\n, 
different_env_vars.size());fflush(stderr);
+bool different_env_content_equals = false;
+if (different_child_env_vars.size() == different_env_vars.size()) {
+different_env_content_equals =
 std::equal(different_env_vars.begin(), different_env_vars.end(), 
different_child_env_vars.begin());
+}
 
 return (common_env_size_equals  common_env_content_equals 
 different_env_size_equals  different_env_content_equals);
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-29 Thread Caolán McNamara
On Tue, 2011-06-28 at 20:23 +0200, Julien Nabet wrote:
 Could it be a cppunit bug ? I think about this one :
 http://sourceforge.net/tracker/?func=detailaid=1764149group_id=11795atid=111795
 Valgrind shows a very large number of calls to new followed by the 
 wrong form of delete when running cppunit tests.
 This is with libcppunit v 1.12.0
 (We use 1.12.1 but this bug is still opened)

We don't see valgrind warnings when we run the test, we checked that
already. I still think its mixed libstdc++ stl iterators _GLIBCXX_DEBUG
and non-_GLIBCXX_DEBUG mode.

C.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-28 Thread Caolán McNamara
On Mon, 2011-06-27 at 20:05 +0200, Julien Nabet wrote:
 Le 27/06/2011 16:57, Caolán McNamara a écrit :
  On Fri, 2011-06-24 at 20:02 +0200, Julien Nabet wrote:
  But when i use  the test file, nothing as you can see below :
 
  $ g++ -D_GLIBCXX_DEBUG attachment.cxx
  $ echo hello world | ./a.out
  Line is: hello world
  Hmm, hard to track down a reproducible test-case then. Anything in
  echo hello world | valgrind ./a.out ?
 $ cat test.c
 #include iostream
 #include string
 
 using namespace std;
 
 int main (int argc, char * const argv[]) {
  string line;
  getline(cin, line);
  cout  Line is: \  line  \  endl;
 return 0;
 }
 $ g++ -D_GLIBCXX_DEBUG test.c
 configure:14449: result: internal

 Are there other tests I could do ?

I reckon this is basically a libstdc++ bug, so we're just looking for
either a reproducer we can submit a bug for, and/or a hackaround for
ourselves in the interim.

So, for a hackaround, I guess we might be looking at a mismatch between
how the internal cppunit is built and the outside world, so to test that
theory, try this patch to the internal cppunit makefile.mk and rm -rf
cppunit/unxlng* and rebuild it and rebuild those sal tests as well,
easiest to just blow them all away.

This might all be futile, be much nicer if we had a small standalone
test-case.

C.
diff --git a/cppunit/makefile.mk b/cppunit/makefile.mk
index 54c55c2..0e588b4 100644
--- a/cppunit/makefile.mk
+++ b/cppunit/makefile.mk
@@ -40,6 +40,10 @@ PATCH_FILES = solarisfinite.patch warnings.patch windows.patch ldflags.patch aix
 # warnings.patch: see https://sourceforge.net/tracker/?func=detail;
 #  aid=2912630group_id=11795atid=311795
 
+.IF $(ENABLE_DEBUG_STL) == TRUE
+EXTRA_CFLAGS+=-D_GLIBCXX_DEBUG
+.ENDIF
+
 .IF $(OS) == WNT
 .IF $(COM) == MSC
 
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-28 Thread Julien Nabet

Le 28/06/2011 16:18, Nigel Hawkins a écrit :

On Tue, 2011-06-28 at 13:45 +0100, Caolán McNamara wrote:

So, for a hackaround, I guess we might be looking at a mismatch between
how the internal cppunit is built and the outside world, so to test that
theory, try this patch to the internal cppunit makefile.mk and rm -rf
cppunit/unxlng* and rebuild it and rebuild those sal tests as well,
easiest to just blow them all away.

This might all be futile, be much nicer if we had a small standalone
test-case.

No joy here. I get exactly the same error with that patch.

Nigel

Same result here, I applied the patch then make clean  make and the 
problem is still there.


Julien.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-28 Thread Julien Nabet

Le 28/06/2011 14:45, Caolán McNamara a écrit :


...
I reckon this is basically a libstdc++ bug, so we're just looking for
either a reproducer we can submit a bug for, and/or a hackaround for
ourselves in the interim.

...

Could it be a cppunit bug ? I think about this one :
http://sourceforge.net/tracker/?func=detailaid=1764149group_id=11795atid=111795
Valgrind shows a very large number of calls to new followed by the 
wrong form of delete when running cppunit tests.

This is with libcppunit v 1.12.0
(We use 1.12.1 but this bug is still opened)
Or, for sure, it's libstdc++ bug ?

Julien.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-27 Thread Caolán McNamara
On Fri, 2011-06-24 at 20:02 +0200, Julien Nabet wrote:
 But when i use  the test file, nothing as you can see below :
 
 $ g++ -D_GLIBCXX_DEBUG attachment.cxx
 $ echo hello world | ./a.out
 Line is: hello world

Hmm, hard to track down a reproducible test-case then. Anything in 
echo hello world | valgrind ./a.out ?
And was this with a system cppunit or the built-in one ?

C.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-27 Thread Julien Nabet

Le 27/06/2011 16:57, Caolán McNamara a écrit :

On Fri, 2011-06-24 at 20:02 +0200, Julien Nabet wrote:

But when i use  the test file, nothing as you can see below :

$ g++ -D_GLIBCXX_DEBUG attachment.cxx
$ echo hello world | ./a.out
Line is: hello world

Hmm, hard to track down a reproducible test-case then. Anything in
echo hello world | valgrind ./a.out ?

$ cat test.c
#include iostream
#include string

using namespace std;

int main (int argc, char * const argv[]) {
string line;
getline(cin, line);
cout  Line is: \  line  \  endl;
   return 0;
}
$ g++ -D_GLIBCXX_DEBUG test.c
$ echo hello world| valgrind ./a.out
==2612== Memcheck, a memory error detector
==2612== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==2612== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==2612== Command: ./a.out
==2612==
Line is: hello world
==2612==
==2612== HEAP SUMMARY:
==2612== in use at exit: 0 bytes in 0 blocks
==2612==   total heap usage: 5 allocs, 5 frees, 96 bytes allocated
==2612==
==2612== All heap blocks were freed -- no leaks are possible
==2612==
==2612== For counts of detected and suppressed errors, rerun with: -v
==2612== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 17 from 6)
$

And was this with a system cppunit or the built-in one ?
libcppunit-1.12-1 and libcppunit-dev are not installed and in 
config.log, I've got :

configure:14349: checking which cppunit to use
configure:14449: result: internal

So I suppose I use the build-in one.

Are there other tests I could do ?

Julien.

___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


[Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-24 Thread Caolán McNamara
On Thu, 2011-06-23 at 19:57 +0100, serv serva wrote:
 Your theory was right, I commented out all that concerns _GLIBCXX_DEBUG in :
 - sal/inc/unxgcc.mk
 - sal/gbuild/platform/unxgcc.mk
 
 Then remove sal/unxlng* and build again.
 Everything is ok.

Excellent, so...

We don't want anyone else to get hung up on that, so ideally we want a
bug filed against your distros libstdc++ about this. So could you see if
the test-case at
http://lists.apple.com/archives/cocoa-dev/2009/Sep/msg01096.html

when compiled with g++ -D_GLIBCXX_DEBUG crashes when you do
echo hello world | ./a.out and file a bug against whatever version of
libstdc++ you have about it.

C.
//compile with g++ -D_GLIBCXX_DEBUG
//see http://lists.apple.com/archives/cocoa-dev/2009/Sep/msg01096.html
//see http://lists.freedesktop.org/archives/libreoffice/2011-June/014191.html

#include iostream
#include string

int main (int argc, char * const argv[])
{
   std::string line;
   std::getline(std::cin, line);
   std::cout  Line is: \  line  \  std::endl;
   return 0;
}
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice


Re: [Libreoffice] [SOLVED] Debug-mode getline-using sal unittest crashes, triggered by _GLIBCXX_DEBUG

2011-06-24 Thread Julien Nabet

Le 24/06/2011 14:19, Caolán McNamara a écrit :

On Thu, 2011-06-23 at 19:57 +0100, serv serva wrote:

Your theory was right, I commented out all that concerns _GLIBCXX_DEBUG in :
- sal/inc/unxgcc.mk
- sal/gbuild/platform/unxgcc.mk

Then remove sal/unxlng* and build again.
Everything is ok.

Excellent, so...

We don't want anyone else to get hung up on that, so ideally we want a
bug filed against your distros libstdc++ about this. So could you see if
the test-case at
http://lists.apple.com/archives/cocoa-dev/2009/Sep/msg01096.html

when compiled with g++ -D_GLIBCXX_DEBUG crashes when you do
echo hello world | ./a.out and file a bug against whatever version of
libstdc++ you have about it.

Hello,

Badfully, I don't reproduce the pb with this file.
I made a rm -rf sal/unxlng* with the unchanged (so with GLIBCXX_DEBUG) 
files :

- sal/inc/unxgcc.mk
- sal/gbuild/platform/unxgcc.mk
and there's still the pb.


But when i use  the test file, nothing as you can see below :

$ g++ -D_GLIBCXX_DEBUG attachment.cxx
$ echo hello world | ./a.out
Line is: hello world

$ cat attachment.cxx
//compile with g++ -D_GLIBCXX_DEBUG
//see http://lists.apple.com/archives/cocoa-dev/2009/Sep/msg01096.html
//see 
http://lists.freedesktop.org/archives/libreoffice/2011-June/014191.html


#include iostream
#include string

int main (int argc, char * const argv[])
{
   std::string line;
   std::getline(std::cin, line);
   std::cout  Line is: \  line  \  std::endl;
   return 0;
}

Julien.
___
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice