[Libreoffice-commits] core.git: Branch 'feature/cib_contract57b' - 3 commits - desktop/Library_crashreport.mk desktop/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Fri Jun 8 14:28:15 UTC 2018


 desktop/Library_crashreport.mk     |    1 +
 desktop/source/app/app.cxx         |    5 +++--
 desktop/source/app/crashreport.cxx |   33 ++++++++++++++++++++++++---------
 3 files changed, 28 insertions(+), 11 deletions(-)

New commits:
commit 21151d01e8340a44af42f3e212529ec6c9ca3b64
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Fri Jan 13 11:50:12 2017 +0100

    Crashdump: Make crash directory configurable
    
    Change-Id: I8106ec674080ede7072581dab2e6700040de5828

diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index dd7b3e66708e..bb3a035524a1 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -90,22 +90,35 @@ void CrashReporter::writeCommonInfo()
 
 namespace {
 
-OUString getCrashUserProfileDirectory()
+OUString getCrashDirectory()
 {
-    OUString url("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/crash/");
-    rtl::Bootstrap::expandMacros(url);
-    osl::Directory::create(url);
+    OUString aCrashURL;
 
-    OUString aProfilePath;
-    osl::FileBase::getSystemPathFromFileURL(url, aProfilePath);
-    return aProfilePath;
+    // First check whether a user-defined path is available (crashreport.ini)
+    OUString aCrashPath("${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("crashreport") ":CrashDirectory}");
+    rtl::Bootstrap::expandMacros(aCrashPath);
+    osl::FileBase::getFileURLFromSystemPath(aCrashPath, aCrashURL);
+
+    // Fall back to user profile
+    if (aCrashPath.isEmpty())
+    {
+        aCrashURL = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" SAL_CONFIGFILE("bootstrap") ":UserInstallation}/crash";
+        rtl::Bootstrap::expandMacros(aCrashURL);
+    }
+
+    if (!aCrashURL.endsWith("/"))
+        aCrashURL += "/";
+    osl::FileBase::RC rc = osl::Directory::create(aCrashURL);
+    (void)rc;
+    osl::FileBase::getSystemPathFromFileURL(aCrashURL, aCrashPath);
+    return aCrashPath;
 }
 
 }
 
 void CrashReporter::updateMinidumpLocation()
 {
-    OUString aURL = getCrashUserProfileDirectory();
+    OUString aURL = getCrashDirectory();
 #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
     OString aOStringUrl = OUStringToOString(aURL, RTL_TEXTENCODING_UTF8);
     google_breakpad::MinidumpDescriptor descriptor(aOStringUrl.getStr());
@@ -122,7 +135,7 @@ void CrashReporter::storeExceptionHandler(google_breakpad::ExceptionHandler* pEx
 
 std::string CrashReporter::getIniFileName()
 {
-    OUString url = getCrashUserProfileDirectory() + "dump.ini";
+    OUString url = getCrashDirectory() + "dump.ini";
     OString aUrl = OUStringToOString(url, RTL_TEXTENCODING_UTF8);
     std::string aRet(aUrl.getStr());
     return aRet;
commit 261862f000dce95013843d4a183ad09fe1639041
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Jan 12 16:47:40 2017 +0100

    Disable CrashReportUI
    
    since we don't offer upload - only want the dumps
    
    Change-Id: I6d084757d83204cb960905d7eb78571b13f8f875

diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index a2b18f201578..03dcdf477817 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1039,7 +1039,8 @@ bool crashReportInfoExists()
 #if HAVE_FEATURE_BREAKPAD
 void handleCrashReport()
 {
-    static const char SERVICENAME_CRASHREPORT[] = "com.sun.star.comp.svx.CrashReportUI";
+    // Don't show the dialog since we don't offer upload - only want the dumps
+    /*static const char SERVICENAME_CRASHREPORT[] = "com.sun.star.comp.svx.CrashReportUI";
 
     css::uno::Reference< css::uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
 
@@ -1053,7 +1054,7 @@ void handleCrashReport()
     css::util::URL aURL;
     css::uno::Any aRet = xRecoveryUI->dispatchWithReturnValue(aURL, css::uno::Sequence< css::beans::PropertyValue >());
     bool bRet = false;
-    aRet >>= bRet;
+    aRet >>= bRet;*/
 }
 #endif
 
commit ea8971414738c35ae683416ddd3d7da30e72f1f9
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Thu Jan 12 16:46:45 2017 +0100

    Add build id to crash metadata
    
    Change-Id: I0e11a96936ea08cc439fcc1b1e3ff1f59c636665

diff --git a/desktop/Library_crashreport.mk b/desktop/Library_crashreport.mk
index ba2f3483a416..d6d9b8b91cc5 100644
--- a/desktop/Library_crashreport.mk
+++ b/desktop/Library_crashreport.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Library_use_libraries,crashreport,\
     cppuhelper \
     sal \
     salhelper \
+    utl \
 	$(gb_UWINAPI) \
 ))
 
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 9715fde513c9..dd7b3e66708e 100644
--- a/desktop/source/app/crashreport.cxx
+++ b/desktop/source/app/crashreport.cxx
@@ -10,6 +10,7 @@
 #include <desktop/crashreport.hxx>
 #include <rtl/bootstrap.hxx>
 #include <osl/file.hxx>
+#include <unotools/bootstrap.hxx>
 
 #include <config_version.h>
 #include <config_folders.h>
@@ -73,6 +74,7 @@ void CrashReporter::writeCommonInfo()
     std::ofstream minidump_file(ini_path, std::ios_base::trunc);
     minidump_file << "ProductName=LibreOffice\n";
     minidump_file << "Version=" LIBO_VERSION_DOTTED "\n";
+    minidump_file << "BuildID=" << utl::Bootstrap::getBuildIdData("") << "\n";
     minidump_file << "URL=http://crashreport.libreoffice.org/submit/\n";
     for (auto& keyValue : maKeyValues)
     {


More information about the Libreoffice-commits mailing list