Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package kcrash for openSUSE:Factory checked in at 2021-03-16 15:40:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/kcrash (Old) and /work/SRC/openSUSE:Factory/.kcrash.new.2401 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "kcrash" Tue Mar 16 15:40:16 2021 rev:89 rq:878793 version:5.80.0 Changes: -------- --- /work/SRC/openSUSE:Factory/kcrash/kcrash.changes 2021-02-17 18:11:43.169949414 +0100 +++ /work/SRC/openSUSE:Factory/.kcrash.new.2401/kcrash.changes 2021-03-16 15:41:30.948759812 +0100 @@ -1,0 +2,14 @@ +Sun Mar 7 09:26:41 UTC 2021 - Christophe Giboudeaux <[email protected]> + +- Update to 5.80.0 + * New feature release + * For more details please see: + * https://kde.org/announcements/frameworks/5/5.80.0 +- Changes since 5.79.0: + * Run clang-format + * Add clang-format pre-commit hook + * Fix build on Android + * Fix X11 dependency conditions + * Fix KCrash usage inside a systemd unit + +------------------------------------------------------------------- Old: ---- kcrash-5.79.0.tar.xz kcrash-5.79.0.tar.xz.sig New: ---- kcrash-5.80.0.tar.xz kcrash-5.80.0.tar.xz.sig ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ kcrash.spec ++++++ --- /var/tmp/diff_new_pack.LsvXHA/_old 2021-03-16 15:41:31.648760932 +0100 +++ /var/tmp/diff_new_pack.LsvXHA/_new 2021-03-16 15:41:31.648760932 +0100 @@ -17,7 +17,7 @@ %define lname libKF5Crash5 -%define _tar_path 5.79 +%define _tar_path 5.80 # Full KF5 version (e.g. 5.33.0) %{!?_kf5_version: %global _kf5_version %{version}} # Last major and minor KF5 version (e.g. 5.33) @@ -25,7 +25,7 @@ # Only needed for the package signature condition %bcond_without lang Name: kcrash -Version: 5.79.0 +Version: 5.80.0 Release: 0 Summary: An application crash handler License: LGPL-2.1-or-later ++++++ kcrash-5.79.0.tar.xz -> kcrash-5.80.0.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/.gitignore new/kcrash-5.80.0/.gitignore --- old/kcrash-5.79.0/.gitignore 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/.gitignore 2021-03-02 19:45:28.000000000 +0100 @@ -21,3 +21,4 @@ *.unc-backup* .cmake/ /.clang-format +/compile_commands.json diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/CMakeLists.txt new/kcrash-5.80.0/CMakeLists.txt --- old/kcrash-5.79.0/CMakeLists.txt 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/CMakeLists.txt 2021-03-02 19:45:28.000000000 +0100 @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 3.5) -set(KF_VERSION "5.79.0") # handled by release scripts -set(KF_DEP_VERSION "5.79.0") # handled by release scripts +set(KF_VERSION "5.80.0") # handled by release scripts +set(KF_DEP_VERSION "5.80.0") # handled by release scripts project(KCrash VERSION ${KF_VERSION}) include(FeatureSummary) -find_package(ECM 5.79.0 NO_MODULE) +find_package(ECM 5.80.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://commits.kde.org/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) @@ -16,9 +16,11 @@ include(KDEInstallDirs) include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) +include(KDEGitCommitHooks) -if (NOT APPLE) +if (UNIX AND NOT APPLE AND NOT ANDROID) find_package(X11) + find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED COMPONENTS X11Extras) endif() set(HAVE_X11 ${X11_FOUND}) @@ -57,7 +59,7 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x050e00) -add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054B00) +add_definitions(-DKF_DISABLE_DEPRECATED_BEFORE_AND_AT=0x054F00) add_definitions(-DQT_NO_FOREACH) add_subdirectory(src) if (BUILD_TESTING) @@ -100,3 +102,5 @@ ) feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES) + +kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/autotests/coreconfigtest.cpp new/kcrash-5.80.0/autotests/coreconfigtest.cpp --- old/kcrash-5.79.0/autotests/coreconfigtest.cpp 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/autotests/coreconfigtest.cpp 2021-03-02 19:45:28.000000000 +0100 @@ -12,7 +12,9 @@ { Q_OBJECT private Q_SLOTS: - void initTestCase() {} + void initTestCase() + { + } void testExec() { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/autotests/kcrashtest.cpp new/kcrash-5.80.0/autotests/kcrashtest.cpp --- old/kcrash-5.79.0/autotests/kcrashtest.cpp 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/autotests/kcrashtest.cpp 2021-03-02 19:45:28.000000000 +0100 @@ -5,16 +5,17 @@ SPDX-License-Identifier: LGPL-2.0-or-later */ -#include <QProcess> +#include <QDebug> #include <QFile> +#include <QProcess> #include <QTest> -#include <QDebug> class KCrashTest : public QObject { Q_OBJECT private Q_SLOTS: - void initTestCase() { + void initTestCase() + { // Don't bring up drkonqi qputenv("KDE_DEBUG", "1"); // change to the bin dir @@ -23,7 +24,6 @@ void testAutoRestart(); void testAutoRestartDirectly(); void testEmergencySave(); - }; static const char s_logFileName[] = "kcrashtest_log"; @@ -50,7 +50,7 @@ QVERIFY(QFile::exists("./test_crasher")); processName = QStringLiteral("./test_crasher"); #endif - //qDebug() << proc.args(); + // qDebug() << proc.args(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.insert(QStringLiteral("ASAN_OPTIONS"), QStringLiteral("handle_segv=0,poison_heap=0")); // Disable ASAN proc.setProcessEnvironment(env); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/autotests/test_crasher.cpp new/kcrash-5.80.0/autotests/test_crasher.cpp --- old/kcrash-5.79.0/autotests/test_crasher.cpp 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/autotests/test_crasher.cpp 2021-03-02 19:45:28.000000000 +0100 @@ -6,12 +6,12 @@ */ #include <QApplication> -#include <QFile> #include <QDebug> +#include <QFile> #include <kcrash.h> #ifdef Q_OS_UNIX -#include <sys/resource.h> // setrlimit #include <errno.h> +#include <sys/resource.h> // setrlimit #endif QFile output; @@ -56,7 +56,7 @@ output.write("\n"); output.flush(); // CRASH! - delete (char*)0xdead; + delete (char *)0xdead; } else { output.write("autorestarted "); output.write(flag); @@ -66,4 +66,3 @@ return 0; } - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/src/coreconfig.cpp new/kcrash-5.80.0/src/coreconfig.cpp --- old/kcrash-5.79.0/src/coreconfig.cpp 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/src/coreconfig.cpp 2021-03-02 19:45:28.000000000 +0100 @@ -10,8 +10,8 @@ #include <config-kcrash.h> -namespace KCrash { - +namespace KCrash +{ CoreConfig::CoreConfig(const QString &path) : m_supported(false) , m_process(false) @@ -19,16 +19,16 @@ #ifndef KCRASH_CORE_PATTERN_RAISE return; // Leave everything false unless enabled. #endif - QFile file(path); - if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { - return; - } - char first = 0; - if (!file.getChar(&first)) { - return; - } - m_supported = true; - m_process = first == '|'; + QFile file(path); + if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { + return; + } + char first = 0; + if (!file.getChar(&first)) { + return; + } + m_supported = true; + m_process = first == '|'; } bool CoreConfig::isProcess() const diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/src/coreconfig_p.h new/kcrash-5.80.0/src/coreconfig_p.h --- old/kcrash-5.79.0/src/coreconfig_p.h 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/src/coreconfig_p.h 2021-03-02 19:45:28.000000000 +0100 @@ -9,8 +9,8 @@ #include <QString> -namespace KCrash { - +namespace KCrash +{ class CoreConfig { public: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/src/kcrash.cpp new/kcrash-5.80.0/src/kcrash.cpp --- old/kcrash-5.79.0/src/kcrash.cpp 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/src/kcrash.cpp 2021-03-02 19:45:28.000000000 +0100 @@ -3,7 +3,7 @@ SPDX-FileCopyrightText: 2000 Timo Hummel <[email protected]> SPDX-FileCopyrightText: 2000 Tom Braun <[email protected]> SPDX-FileCopyrightText: 2010 George Kiagiadakis <[email protected]> - SPDX-FileCopyrightText: 2009 KDE e.V. <[email protected]> + SPDX-FileCopyrightText: 2009 KDE e.V. <[email protected]> SPDX-FileContributor: 2009 Adriaan de Groot <[email protected]> SPDX-License-Identifier: LGPL-2.0-or-later @@ -13,16 +13,16 @@ #include <config-kcrash.h> -#include <string.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <qplatformdefs.h> #ifndef Q_OS_WIN +#include <errno.h> #include <sys/resource.h> #include <sys/un.h> -#include <errno.h> #else #include <qt_windows.h> #endif @@ -34,16 +34,16 @@ #include <KAboutData> #include <kstartupinfo.h> -#include <array> #include <algorithm> +#include <array> #include <memory> #include <QDebug> +#include <QFile> #include <QGuiApplication> +#include <QLibraryInfo> #include <QStandardPaths> #include <QThread> -#include <QLibraryInfo> -#include <QFile> #include <QLoggingCategory> Q_DECLARE_LOGGING_CATEGORY(LOG_KCRASH) @@ -52,8 +52,8 @@ Q_LOGGING_CATEGORY(LOG_KCRASH, "kf.crash", QtInfoMsg) #if HAVE_X11 -#include <qx11info_x11.h> #include <X11/Xlib.h> +#include <qx11info_x11.h> #endif #ifdef Q_OS_SOLARIS @@ -72,7 +72,7 @@ typedef struct { long cmd; long arg_length; -} kcrash_launcher_header; +} kcrash_launcher_header; #define LAUNCHER_OK 4 #define LAUNCHER_EXEC_NEW 12 @@ -81,14 +81,13 @@ { KCRASH_EXPORT bool loadedByKdeinit = false; void setApplicationFilePath(const QString &filePath); - // Create socket path to transfer ptrace scope and open connection +// Create socket path to transfer ptrace scope and open connection } #ifdef Q_OS_LINUX static QByteArray s_socketpath; #endif -struct Args -{ +struct Args { ~Args() { clear(); @@ -137,13 +136,13 @@ static std::unique_ptr<char[]> s_drkonqiPath; static KCrash::CrashFlags s_flags = KCrash::CrashFlags(); static int s_launchDrKonqi = -1; // -1=initial value 0=disabled 1=enabled +static int s_originalSignal = -1; static std::unique_ptr<char[]> s_kcrashErrorMessage; Q_GLOBAL_STATIC(KCrash::CoreConfig, s_coreConfig) static void kcrashInitialize() { - // Static because in some cases this is called multiple times // but if an application had any of the bad cases we always want // to skip the check @@ -196,14 +195,14 @@ return; } const QStringList args = QCoreApplication::arguments(); - if (!qEnvironmentVariableIsSet("KDE_DEBUG") - && !qEnvironmentVariableIsSet("KCRASH_AUTO_RESTARTED") + if (!qEnvironmentVariableIsSet("KDE_DEBUG") // + && !qEnvironmentVariableIsSet("KCRASH_AUTO_RESTARTED") // && !qEnvironmentVariableIntValue("RUNNING_UNDER_RR")) { // enable drkonqi KCrash::setDrKonqiEnabled(true); } else { // This loads qtlogging.ini very early which prevents unittests from doing QStandardPaths::setTestModeEnabled(true) in initTestCase() - //qCDebug(LOG_KCRASH) << "KCrash disabled through environment."; + // qCDebug(LOG_KCRASH) << "KCrash disabled through environment."; } if (QCoreApplication::instance()) { @@ -214,16 +213,15 @@ #ifdef Q_OS_LINUX // Create socket path to transfer ptrace scope and open connection - s_socketpath = QFile::encodeName( - QStringLiteral("%1/kcrash_%2").arg(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation)) - .arg(getpid())); + s_socketpath = QFile::encodeName(QStringLiteral("%1/kcrash_%2") // + .arg(QStandardPaths::writableLocation(QStandardPaths::RuntimeLocation)) + .arg(getpid())); #endif s_coreConfig(); // Initialize. } -void -KCrash::setEmergencySaveFunction(HandlerType saveFunction) +void KCrash::setEmergencySaveFunction(HandlerType saveFunction) { s_emergencySaveFunction = saveFunction; @@ -236,8 +234,7 @@ } } -KCrash::HandlerType -KCrash::emergencySaveFunction() +KCrash::HandlerType KCrash::emergencySaveFunction() { return s_emergencySaveFunction; } @@ -255,6 +252,7 @@ { startTimer(10000); // 10 s } + protected: void timerEvent(QTimerEvent *event) override { @@ -266,8 +264,7 @@ } }; -void -KCrash::setFlags(KCrash::CrashFlags flags) +void KCrash::setFlags(KCrash::CrashFlags flags) { s_flags = flags; if (s_flags & AutoRestart) { @@ -314,11 +311,11 @@ s_launchDrKonqi = launchDrKonqi; if (s_launchDrKonqi && !s_drkonqiPath) { // search paths - const QStringList paths = QStringList() - << QFile::decodeName(qgetenv("LIBEXEC_PATH")).split(QLatin1Char(':'), Qt::SkipEmptyParts) // env var is used first - << QCoreApplication::applicationDirPath() // then look where our application binary is located - << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) // look where libexec path is (can be set in qt.conf) - << QFile::decodeName(KDE_INSTALL_FULL_LIBEXECDIR); // look at our installation location + const QStringList paths = + QStringList() << QFile::decodeName(qgetenv("LIBEXEC_PATH")).split(QLatin1Char(':'), Qt::SkipEmptyParts) // env var is used first + << QCoreApplication::applicationDirPath() // then look where our application binary is located + << QLibraryInfo::location(QLibraryInfo::LibraryExecutablesPath) // look where libexec path is (can be set in qt.conf) + << QFile::decodeName(KDE_INSTALL_FULL_LIBEXECDIR); // look at our installation location const QString exec = QStandardPaths::findExecutable(QStringLiteral("drkonqi"), paths); if (exec.isEmpty()) { qCDebug(LOG_KCRASH) << "Could not find drkonqi in search paths:" << paths; @@ -328,7 +325,7 @@ } } - //we need at least the default crash handler to launch drkonqi + // we need at least the default crash handler to launch drkonqi if (s_launchDrKonqi && !s_crashHandler) { setCrashHandler(defaultCrashHandler); } @@ -339,8 +336,7 @@ return s_launchDrKonqi == 1; } -void -KCrash::setCrashHandler(HandlerType handler) +void KCrash::setCrashHandler(HandlerType handler) { #if defined(Q_OS_WIN) static LPTOP_LEVEL_EXCEPTION_FILTER s_previousExceptionFilter = NULL; @@ -386,15 +382,13 @@ s_crashHandler = handler; } -KCrash::HandlerType -KCrash::crashHandler() +KCrash::HandlerType KCrash::crashHandler() { return s_crashHandler; } #if !defined(Q_OS_WIN) && !defined(Q_OS_OSX) -static void -closeAllFDs() +static void closeAllFDs() { // Close all remaining file descriptors except for stdin/stdout/stderr struct rlimit rlp; @@ -405,13 +399,19 @@ } #endif -void -KCrash::defaultCrashHandler(int sig) +void crashOnSigTerm(int sig) +{ + Q_UNUSED(sig) + raise(s_originalSignal); +} + +void KCrash::defaultCrashHandler(int sig) { // WABA: Do NOT use qDebug() in this function because it is much too risky! // Handle possible recursions static int crashRecursionCounter = 0; crashRecursionCounter++; // Nothing before this, please ! + s_originalSignal = sig; #if !defined(Q_OS_WIN) signal(SIGALRM, SIG_DFL); @@ -419,7 +419,7 @@ #endif #ifdef Q_OS_SOLARIS - (void) printstack(2 /* stderr, assuming it's still open. */); + (void)printstack(2 /* stderr, assuming it's still open. */); #endif if (crashRecursionCounter < 2) { @@ -437,28 +437,28 @@ if (!(s_flags & KeepFDs)) { closeAllFDs(); } -# if HAVE_X11 +#if HAVE_X11 else if (QX11Info::display()) { close(ConnectionNumber(QX11Info::display())); } -# endif +#endif #endif if (crashRecursionCounter < 3) { #ifndef NDEBUG - fprintf(stderr, "KCrash: crashing... crashRecursionCounter = %d\n", - crashRecursionCounter); - fprintf(stderr, "KCrash: Application Name = %s path = %s pid = %lld\n", + fprintf(stderr, "KCrash: crashing... crashRecursionCounter = %d\n", crashRecursionCounter); + fprintf(stderr, + "KCrash: Application Name = %s path = %s pid = %lld\n", s_appName ? s_appName.get() : "<unknown>", - s_appPath ? s_appPath.get() : "<unknown>", QCoreApplication::applicationPid()); + s_appPath ? s_appPath.get() : "<unknown>", + QCoreApplication::applicationPid()); fprintf(stderr, "KCrash: Arguments: "); for (int i = 0; i < s_autoRestartCommandLine.argc; ++i) { fprintf(stderr, "%s ", s_autoRestartCommandLine.argv[i]); } fprintf(stderr, "\n"); #else - fprintf(stderr, "KCrash: Application '%s' crashing...\n", - s_appName ? s_appName.get() : "<unknown>"); + fprintf(stderr, "KCrash: Application '%s' crashing...\n", s_appName ? s_appName.get() : "<unknown>"); #endif if (s_launchDrKonqi != 1) { @@ -469,7 +469,10 @@ return; } - const char *argv[29]; // don't forget to update this + // If someone is telling me to stop while I'm aleady crashing, then I should resume crashing + signal(SIGTERM, &crashOnSigTerm); + + const char *argv[29]; // don't forget to update this int i = 0; // argument 0 has to be drkonqi @@ -507,12 +510,12 @@ } // signal number -- will never be NULL - char sigtxt[ 10 ]; + char sigtxt[10]; sprintf(sigtxt, "%d", sig); argv[i++] = "--signal"; argv[i++] = sigtxt; - char pidtxt[ 20 ]; + char pidtxt[20]; sprintf(pidtxt, "%lld", QCoreApplication::applicationPid()); argv[i++] = "--pid"; argv[i++] = pidtxt; @@ -547,11 +550,11 @@ } if ((s_flags & AutoRestart) && s_autoRestartCommandLine) { - argv[i++] = "--restarted"; //tell drkonqi if the app has been restarted + argv[i++] = "--restarted"; // tell drkonqi if the app has been restarted } #if defined(Q_OS_WIN) - char threadId[8] = { 0 }; + char threadId[8] = {0}; sprintf(threadId, "%d", GetCurrentThreadId()); argv[i++] = "--thread"; argv[i++] = threadId; @@ -589,15 +592,10 @@ } PROCESS_INFORMATION procInfo; - STARTUPINFOW startupInfo = { sizeof(STARTUPINFO), 0, 0, 0, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - - bool success = CreateProcess(0, (wchar_t *) cmdLine.utf16(), NULL, NULL, - false, CREATE_UNICODE_ENVIRONMENT, NULL, NULL, - &startupInfo, &procInfo); + STARTUPINFOW startupInfo = + {sizeof(STARTUPINFO), 0, 0, 0, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, (ulong)CW_USEDEFAULT, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + + bool success = CreateProcess(0, (wchar_t *)cmdLine.utf16(), NULL, NULL, false, CREATE_UNICODE_ENVIRONMENT, NULL, NULL, &startupInfo, &procInfo); if (success && waitAndExit) { // wait for child to exit @@ -606,7 +604,7 @@ } } -//glue function for calling the unix signal handler from the windows unhandled exception filter +// glue function for calling the unix signal handler from the windows unhandled exception filter LONG WINAPI KCrash::win32UnhandledExceptionFilter(_EXCEPTION_POINTERS *exceptionInfo) { // kdbgwin needs the context inside exceptionInfo because if getting the context after the @@ -614,29 +612,18 @@ // ntdll.dll, which is supposed to dispatch the exception from kernel mode back to user mode // so... let's create some shared memory HANDLE hMapFile = NULL; - hMapFile = CreateFileMapping( - INVALID_HANDLE_VALUE, - NULL, - PAGE_READWRITE, - 0, - sizeof(CONTEXT), - TEXT("Local\\KCrashShared")); + hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, sizeof(CONTEXT), TEXT("Local\\KCrashShared")); LPCTSTR pBuf = NULL; - pBuf = (LPCTSTR) MapViewOfFile( - hMapFile, - FILE_MAP_ALL_ACCESS, - 0, - 0, - sizeof(CONTEXT)); - CopyMemory((PVOID) pBuf, exceptionInfo->ContextRecord, sizeof(CONTEXT)); + pBuf = (LPCTSTR)MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, sizeof(CONTEXT)); + CopyMemory((PVOID)pBuf, exceptionInfo->ContextRecord, sizeof(CONTEXT)); if (s_crashHandler) { s_crashHandler(exceptionInfo->ExceptionRecord->ExceptionCode); } CloseHandle(hMapFile); - return EXCEPTION_EXECUTE_HANDLER; //allow windows to do the default action (terminate) + return EXCEPTION_EXECUTE_HANDLER; // allow windows to do the default action (terminate) } #else @@ -670,7 +657,7 @@ // a debugger it is not an ancestor of (because it was started via kdeinit or // KProcess::startDetached()) using a socket. #ifndef PR_SET_PTRACER -# define PR_SET_PTRACER 0x59616d61 +#define PR_SET_PTRACER 0x59616d61 #endif prctl(PR_SET_PTRACER, pid, 0, 0, 0); @@ -679,14 +666,14 @@ if (sockfd >= 0) { // Wait while DrKonqi is running and the socket connection exists // If the process was started directly, use waitpid(), as it's a child... - while ((running = waitpid(pid, nullptr, WNOHANG) != pid) && pollDrKonqiSocket(pid, sockfd) >= 0) {} + while ((running = waitpid(pid, nullptr, WNOHANG) != pid) && pollDrKonqiSocket(pid, sockfd) >= 0) { } close(sockfd); unlink(s_socketpath.constData()); } #endif if (running) { // If the process was started directly, use waitpid(), as it's a child... - while (waitpid(pid, nullptr, 0) != pid) {} + while (waitpid(pid, nullptr, 0) != pid) { } } if (!s_coreConfig->isProcess()) { // Only exit if we don't forward to core dumps @@ -698,19 +685,18 @@ extern "C" char **environ; static pid_t startDirectly(const char *argv[]) { - char** environ_end; - for(environ_end = environ; *environ_end; ++environ_end) {} + char **environ_end; + for (environ_end = environ; *environ_end; ++environ_end) { } - std::array<const char*, 1024> environ_data; //hope it's big enough - if((unsigned)(environ_end - environ) +2 >= environ_data.size()) { + std::array<const char *, 1024> environ_data; // hope it's big enough + if ((unsigned)(environ_end - environ) + 2 >= environ_data.size()) { fprintf(stderr, "environ_data in KCrash not big enough!\n"); return 0; } - auto end = std::copy_if(environ, environ_end, environ_data.begin(), - [](const char* s) { - static const char envvar[] = "KCRASH_AUTO_RESTARTED="; - return strncmp(envvar, s, sizeof(envvar)-1) != 0; - }); + auto end = std::copy_if(environ, environ_end, environ_data.begin(), [](const char *s) { + static const char envvar[] = "KCRASH_AUTO_RESTARTED="; + return strncmp(envvar, s, sizeof(envvar) - 1) != 0; + }); *end++ = "KCRASH_AUTO_RESTARTED=1"; *end++ = nullptr; pid_t pid = fork(); @@ -721,12 +707,12 @@ case 0: setgroups(0, nullptr); // Remove any extraneous groups if (setgid(getgid()) < 0 || setuid(getuid()) < 0) { - _exit(253); // This cannot happen. Theoretically. + _exit(253); // This cannot happen. Theoretically. } #ifndef Q_OS_OSX closeAllFDs(); // We are in the child now. Close FDs unconditionally. #endif - execve(argv[0], const_cast< char ** >(argv), const_cast<char**> (environ_data.data())); + execve(argv[0], const_cast<char **>(argv), const_cast<char **>(environ_data.data())); fprintf(stderr, "KCrash failed to exec(), errno = %d\n", errno); _exit(253); default: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/kcrash-5.79.0/src/kcrash.h new/kcrash-5.80.0/src/kcrash.h --- old/kcrash-5.79.0/src/kcrash.h 2021-01-30 18:39:54.000000000 +0100 +++ new/kcrash-5.80.0/src/kcrash.h 2021-03-02 19:45:28.000000000 +0100 @@ -34,7 +34,6 @@ */ namespace KCrash { - /** * Initialize KCrash. * @@ -106,10 +105,11 @@ * @see CrashFlags */ enum CrashFlag { - KeepFDs = 1, ///< don't close all file descriptors immediately - SaferDialog = 2, ///< start DrKonqi without arbitrary disk access - AlwaysDirectly = 4, ///< never try to to start DrKonqi via kdeinit. Use fork() and exec() instead. @deprecated This is now the default, and does not need to be set. - AutoRestart = 8 ///< autorestart this application. Only sensible for KUniqueApplications. @since 4.1. + KeepFDs = 1, ///< don't close all file descriptors immediately + SaferDialog = 2, ///< start DrKonqi without arbitrary disk access + AlwaysDirectly = + 4, ///< never try to to start DrKonqi via kdeinit. Use fork() and exec() instead. @deprecated This is now the default, and does not need to be set. + AutoRestart = 8, ///< autorestart this application. Only sensible for KUniqueApplications. @since 4.1. }; /** * Stores a combination of #CrashFlag values. @@ -157,4 +157,3 @@ } #endif -
