[Libreoffice-commits] core.git: Branch 'distro/cib/libreoffice-5-3' - desktop/Library_crashreport.mk desktop/source
Samuel Mehrbrodt
Samuel.Mehrbrodt at cib.de
Thu Jul 12 16:21:24 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 b9872d6593892216ff4dde890ce45bcf8dea37fc
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date: Thu Jan 12 16:46:45 2017 +0100
Disable crash reporter UI, add local store option
- add build id to crash metadata
- disable CrashReportUI
- make crash directory configurable
Change-Id: I8106ec674080ede7072581dab2e6700040de5828
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/app.cxx b/desktop/source/app/app.cxx
index 1f9307d0c26f..90529e05c93c 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -1073,7 +1073,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();
@@ -1087,7 +1088,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
diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx
index 9715fde513c9..bb3a035524a1 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)
{
@@ -88,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());
@@ -120,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;
More information about the Libreoffice-commits
mailing list