On 01/29/2013 09:31 PM, Henrik /KaarPoSoft wrote:
On 01/29/2013 01:53 PM, Stephan Bergmann wrote:
On 01/24/2013 10:43 PM, Henrik /KaarPoSoft wrote:
On 01/24/2013 10:09 AM, Stephan Bergmann wrote:
On 01/24/2013 12:33 AM, Henrik /KaarPoSoft wrote:
On 01/23/2013 04:54 PM, Stephan Bergmann wrote:
On 01/23/2013 08:31 AM, Henrik /KaarPoSoft wrote:
Your strace lines like
[...]
look oddly truncated.  For example, there should be a
.../program/boostraprc file that soffice.bin would indeed try to open
early on.


So I just ran into a problem with a libreoffice-4-0-0 build of mine on
Mac OS X whose symptoms looked very much like the above, expanding LO
bootstrap variables ($UserInstallation from bootstraprc in my case) to
pathnames that were oddly truncated.  I tracked that down to bad calls
to putenv (the code to expand bootstrap variables in
sal/rtl/source/bootstrap.cxx tries to obtain values for that variables
via getenv, among others, so it is susceptible to problems resulting
from a broken environment), see
<http://cgit.freedesktop.org/libreoffice/core/commit/?id=d841273ba54b173020aa8da18ba7841cf950c13c>

"Do not call putenv with a temporary string argument."

While that fix is in Mac OS X specific code (so cannot be the cause of
your Linux problems), there are more calls to putenv in the LO code
base, and some of the might be broken in a similar way.

Stephan


I have applied the attached patch to my build.
Some of the changes are just quick-and-dirty, and leaking.
However, with those patches strace does not show any oddly truncated lines, and LibreOffice continues a bit longer before dying on me (but I will address this in another subject).

Thank you very much for your help!

/Henrik

diff -Naur libreoffice-4.0.0.3.ORIG/cppuhelper/test/loader/loader.test.cxx libreoffice-4.0.0.3/cppuhelper/test/loader/loader.test.cxx
--- libreoffice-4.0.0.3.ORIG/cppuhelper/test/loader/loader.test.cxx	2013-01-31 11:54:53.000000000 +0100
+++ libreoffice-4.0.0.3/cppuhelper/test/loader/loader.test.cxx	2013-02-06 18:04:23.239228816 +0100
@@ -130,11 +130,7 @@
     result += servicePurpose;
     result += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("\") - "));
 
-    char buff[256];
-    strcpy(buff, "TestComponent.uno=");
-    strcat(buff, pServicePurpose);
-
-    putenv(buff);
+    setenv("TestComponent.uno", pServicePurpose, 1);
 
     try {
         cppu::writeSharedLibComponentInfo(
diff -Naur libreoffice-4.0.0.3.ORIG/sal/osl/unx/process.cxx libreoffice-4.0.0.3/sal/osl/unx/process.cxx
--- libreoffice-4.0.0.3.ORIG/sal/osl/unx/process.cxx	2013-01-31 11:54:53.000000000 +0100
+++ libreoffice-4.0.0.3/sal/osl/unx/process.cxx	2013-02-06 18:04:23.239228816 +0100
@@ -272,7 +272,7 @@
                 }
                 else
                 {
-                    putenv(data.m_pszEnv[i]); /*TODO: check error return*/
+                    putenv(strdup(data.m_pszEnv[i])); /*TODO: check error return*/
                 }
             }
 
diff -Naur libreoffice-4.0.0.3.ORIG/sal/osl/unx/signal.c libreoffice-4.0.0.3/sal/osl/unx/signal.c
--- libreoffice-4.0.0.3.ORIG/sal/osl/unx/signal.c	2013-01-31 11:54:53.000000000 +0100
+++ libreoffice-4.0.0.3/sal/osl/unx/signal.c	2013-02-06 18:06:03.264680154 +0100
@@ -542,7 +542,6 @@
                     if ( strEnv )
                     {
                         putenv( rtl_string_getStr( strEnv ) );
-                        rtl_string_release( strEnv );
                     }
 
                     rtl_uString_release( ustrEnvironment );
diff -Naur libreoffice-4.0.0.3.ORIG/svtools/bmpmaker/bmp.cxx libreoffice-4.0.0.3/svtools/bmpmaker/bmp.cxx
--- libreoffice-4.0.0.3.ORIG/svtools/bmpmaker/bmp.cxx	2013-01-31 11:54:53.000000000 +0100
+++ libreoffice-4.0.0.3/svtools/bmpmaker/bmp.cxx	2013-02-06 18:08:42.648988158 +0100
@@ -217,10 +217,7 @@
 int main( int nArgCount, char* ppArgs[] )
 {
 #ifdef UNX
-    static char aDisplayVar[ 1024 ];
-
-    strcpy( aDisplayVar, "DISPLAY=" );
-    putenv( aDisplayVar );
+    setenv("DISPLAY", "", 1);
 #endif
 
     ::std::vector< String > aArgs;
diff -Naur libreoffice-4.0.0.3.ORIG/svtools/bmpmaker/bmpsum.cxx libreoffice-4.0.0.3/svtools/bmpmaker/bmpsum.cxx
--- libreoffice-4.0.0.3.ORIG/svtools/bmpmaker/bmpsum.cxx	2013-01-31 11:54:53.000000000 +0100
+++ libreoffice-4.0.0.3/svtools/bmpmaker/bmpsum.cxx	2013-02-06 18:08:48.848078258 +0100
@@ -450,10 +450,7 @@
 int main( int nArgCount, char* ppArgs[] )
 {
 #ifdef UNX
-    static char aDisplayVar[ 1024 ];
-
-    strcpy( aDisplayVar, "DISPLAY=" );
-    putenv( aDisplayVar );
+    setenv("DISPLAY", "", 1);
 #endif
 
     ::std::vector< String > aArgs;
_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

Reply via email to