config_host.mk.in | 1 configure.ac | 15 +++++++++++ cui/Library_cui.mk | 3 ++ cui/source/options/optgdlg.cxx | 6 +++- desktop/source/app/crashreport.cxx | 43 +++++++++++++++++++++++++-------- include/desktop/crashreport.hxx | 2 + instsetoo_native/CustomTarget_setup.mk | 1 scp2/source/ooo/common_brand.scp | 9 ++++++ 8 files changed, 68 insertions(+), 12 deletions(-)
New commits: commit a1b6dc0d58d45f00198bf4755006ebbf66a8c365 Author: Juergen Funk <juergen.funk...@cib.de> AuthorDate: Wed Sep 18 11:48:21 2019 +0200 Commit: Thorsten Behrens <thorsten.behr...@cib.de> CommitDate: Thu Jan 23 15:46:46 2020 +0100 tdf#127711 - A runtime-switch for the MiniCrashDump - in soffice.ini (sofficerc) the entry "CrashDumpEnable" default is "true" - when false then the Dump.ini and the dump-file are not written - when the switch --disable-crashdump is set, then the switch "CrashDumpEnable" set to "false" - when the entry "CrashDumpEnable" is missing, in this case is the default true, too - the checkbox under Options-General "Send crash reports to ..." is deactive and shows off (only view, not change the config) - when set the environment variable "CRASH_DUMP_ENABLE" to any char then the switch "CrashDumpEnable=false" are overrules with true and the Dump.ini and dump-file are write Reviewed-on: https://gerrit.libreoffice.org/79273 Tested-by: Jenkins Reviewed-by: Juergen Funk (CIB) <juergen.funk...@cib.de> (cherry picked from commit 2215be5268a646d3cc7d138a0184c6826585b7fb) §§{JNKCMD:NoBuild}§§ Change-Id: I34e7795640eb95d111e18b0ad46ec67b2c126b19 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87263 Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de> Tested-by: Thorsten Behrens <thorsten.behr...@cib.de> diff --git a/config_host.mk.in b/config_host.mk.in index 683abbff2e05..767011a1cb5d 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -110,6 +110,7 @@ export EBOOK_CFLAGS=$(gb_SPACE)@EBOOK_CFLAGS@ export EBOOK_LIBS=$(gb_SPACE)@EBOOK_LIBS@ export ENABLE_AVAHI=@ENABLE_AVAHI@ export ENABLE_BREAKPAD=@ENABLE_BREAKPAD@ +export DEFAULT_CRASHDUMP_VALUE=@DEFAULT_CRASHDUMP_VALUE@ export ENABLE_CAIRO_CANVAS=@ENABLE_CAIRO_CANVAS@ export ENABLE_CHART_TESTS=@ENABLE_CHART_TESTS@ export ENABLE_CIPHER_OPENSSL_BACKEND=@ENABLE_CIPHER_OPENSSL_BACKEND@ diff --git a/configure.ac b/configure.ac index 502e53e28862..da7e24c30b47 100644 --- a/configure.ac +++ b/configure.ac @@ -1051,6 +1051,11 @@ libo_FUZZ_ARG_ENABLE(breakpad, [Enables breakpad for crash reporting.]) ) +libo_FUZZ_ARG_ENABLE(crashdump, + AS_HELP_STRING([--disable-crashdump], + [Disable dump.ini and dump-file, when --enable-breakpad]) +) + AC_ARG_ENABLE(fetch-external, AS_HELP_STRING([--disable-fetch-external], [Disables fetching external tarballs from web sources.]) @@ -9157,6 +9162,7 @@ AC_SUBST(ICU_UCHAR_TYPE) dnl ================================================================== dnl Breakpad dnl ================================================================== +DEFAULT_CRASHDUMP_VALUE="true" AC_MSG_CHECKING([whether to enable breakpad]) if test "$enable_breakpad" != yes; then AC_MSG_RESULT([no]) @@ -9167,6 +9173,14 @@ else AC_DEFINE(HAVE_FEATURE_BREAKPAD, 1) BUILD_TYPE="$BUILD_TYPE BREAKPAD" + AC_MSG_CHECKING([for disable crash dump]) + if test "$enable_crashdump" = no; then + DEFAULT_CRASHDUMP_VALUE="false" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + AC_MSG_CHECKING([for crashreport config]) if test "$with_symbol_config" = "no"; then BREAKPAD_SYMBOL_CONFIG="invalid" @@ -9179,6 +9193,7 @@ else AC_SUBST(BREAKPAD_SYMBOL_CONFIG) fi AC_SUBST(ENABLE_BREAKPAD) +AC_SUBST(DEFAULT_CRASHDUMP_VALUE) dnl ================================================================== dnl libfuzzer diff --git a/cui/Library_cui.mk b/cui/Library_cui.mk index 44bac812c557..302c6890729c 100644 --- a/cui/Library_cui.mk +++ b/cui/Library_cui.mk @@ -60,6 +60,9 @@ $(eval $(call gb_Library_use_libraries,cui,\ ucbhelper \ utl \ vcl \ + $(if $(ENABLE_BREAKPAD), \ + crashreport \ + ) \ )) $(eval $(call gb_Library_use_externals,cui,\ diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 7949342e40d1..e8fc180bb3b4 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -69,6 +69,8 @@ #include <officecfg/Office/Common.hxx> #include <officecfg/Setup.hxx> #include <comphelper/configuration.hxx> +#include <tools/diagnose_ex.h> +#include <desktop/crashreport.hxx> #include <com/sun/star/configuration/theDefaultProvider.hpp> #include <com/sun/star/container/XNameAccess.hpp> @@ -427,8 +429,8 @@ void OfaMiscTabPage::Reset( const SfxItemSet* rSet ) m_pCollectUsageInfo->SaveValue(); #if HAVE_FEATURE_BREAKPAD - m_xCrashReport->Check(officecfg::Office::Common::Misc::CrashReport::get()); - m_xCrashReport->Enable(!officecfg::Office::Common::Misc::CrashReport::isReadOnly()); + m_xCrashReport->Check(officecfg::Office::Common::Misc::CrashReport::get() && CrashReporter::IsDumpEnable()); + m_xCrashReport->Enable(!officecfg::Office::Common::Misc::CrashReport::isReadOnly() && CrashReporter::IsDumpEnable()); m_xCrashReport->SaveValue(); #else m_xCrashReport->Hide(); diff --git a/desktop/source/app/crashreport.cxx b/desktop/source/app/crashreport.cxx index 2fb078c7417d..71434ac5b965 100644 --- a/desktop/source/app/crashreport.cxx +++ b/desktop/source/app/crashreport.cxx @@ -62,15 +62,18 @@ void CrashReporter::addKeyValue(const OUString& rKey, const OUString& rValue, tA { osl::MutexGuard aGuard(maMutex); - if(!rKey.isEmpty()) - maKeyValues.push_back(mpair(rKey, rValue)); - - if(AddKeyHandling != AddItem) + if (IsDumpEnable()) { - if(mbInit) - writeToFile(std::ios_base::app); - else if (AddKeyHandling == Create) - writeCommonInfo(); + if (!rKey.isEmpty()) + maKeyValues.push_back(mpair(rKey, rValue)); + + if (AddKeyHandling != AddItem) + { + if (mbInit) + writeToFile(std::ios_base::app); + else if (AddKeyHandling == Create) + writeCommonInfo(); + } } } @@ -84,8 +87,9 @@ void CrashReporter::writeCommonInfo() const ucbhelper::InternetProxyServer proxy_server = proxy_decider.getProxy(protocol, url, port); - // save the Keys + // save the new Keys vmaKeyValues atlast = maKeyValues; + // clear the keys, the following Keys should be at the begin maKeyValues.clear(); // limit the amount of code that needs to be executed before the crash reporting @@ -99,6 +103,7 @@ void CrashReporter::writeCommonInfo() addKeyValue("Proxy", proxy_server.aName + ":" + OUString::number(proxy_server.nPort), AddItem); } + // write the new keys at the end maKeyValues.insert(maKeyValues.end(), atlast.begin(), atlast.end()); mbInit = true; @@ -168,9 +173,27 @@ bool CrashReporter::readSendConfig(std::string& response) void CrashReporter::storeExceptionHandler(google_breakpad::ExceptionHandler* pExceptionHandler) { - mpExceptionHandler = pExceptionHandler; + if(IsDumpEnable()) + mpExceptionHandler = pExceptionHandler; +} + + + +bool CrashReporter::IsDumpEnable() +{ + OUString sToken; + OString sEnvVar(std::getenv("CRASH_DUMP_ENABLE")); + bool bEnable = true; // default, always on + // read configuration item 'CrashDumpEnable' -> bool on/off + if (rtl::Bootstrap::get("CrashDumpEnable", sToken) && sEnvVar.isEmpty()) + { + bEnable = sToken.toBoolean(); + } + + return bEnable; } + std::string CrashReporter::getIniFileName() { OUString url = getCrashDirectory() + "dump.ini"; diff --git a/include/desktop/crashreport.hxx b/include/desktop/crashreport.hxx index 3af83b8e637c..585c0af5e1a9 100644 --- a/include/desktop/crashreport.hxx +++ b/include/desktop/crashreport.hxx @@ -52,6 +52,8 @@ public: static bool readSendConfig(std::string& response); + static bool IsDumpEnable(); + private: static osl::Mutex maMutex; static bool mbInit; diff --git a/instsetoo_native/CustomTarget_setup.mk b/instsetoo_native/CustomTarget_setup.mk index ec31d718a6a0..f6df56be5c45 100644 --- a/instsetoo_native/CustomTarget_setup.mk +++ b/instsetoo_native/CustomTarget_setup.mk @@ -119,6 +119,7 @@ $(call gb_CustomTarget_get_workdir,instsetoo_native/setup)/$(call gb_Helper_get_ ( \ echo '[Bootstrap]' \ && echo 'CrashDirectory=$${$$BRAND_BASE_DIR/$(LIBO_ETC_FOLDER)/$(call gb_Helper_get_rcfile,bootstrap):UserInstallation}/crash' \ + && echo 'CrashDumpEnable=$(DEFAULT_CRASHDUMP_VALUE)' \ && echo 'HideEula=1' \ && echo 'Logo=1' \ && echo 'NativeProgress=false' \ diff --git a/scp2/source/ooo/common_brand.scp b/scp2/source/ooo/common_brand.scp index 08e3b43df660..1209c5786fb5 100644 --- a/scp2/source/ooo/common_brand.scp +++ b/scp2/source/ooo/common_brand.scp @@ -439,6 +439,15 @@ ProfileItem gid_Brand_Profileitem_Soffice_CrashDirectory Value = "${$BRAND_BASE_DIR/" LIBO_ETC_FOLDER "/" PROFILENAME(bootstrap) ":UserInstallation}/crash"; End +ProfileItem gid_Brand_Profileitem_Soffice_CrashDump + ProfileID = gid_Brand_Profile_Soffice_Ini; + ModuleID = gid_Module_Root_Brand; + Section = "Bootstrap"; + Key = "CrashDumpEnable"; + Value = "true"; +End + + ProfileItem gid_Brand_Profileitem_Soffice_SecureUserConfig ProfileID = gid_Brand_Profile_Soffice_Ini; ModuleID = gid_Module_Root_Brand; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits