aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAqua-sama <aqua@iserlohn-fortress.net>2020-10-04 16:48:54 +0300
committerAqua-sama <aqua@iserlohn-fortress.net>2020-10-04 20:14:05 +0300
commitdb3c9c8d3b5903b353bca2fa349d3386c1f68096 (patch)
tree53775743b0f1ec64c271175f595d06502ea1bcaf
parentRemove outparam section in Configuration parse (diff)
downloadsmolbote-db3c9c8d3b5903b353bca2fa349d3386c1f68096.tar.xz
Remove Breakpad optdepend
-rw-r--r--Kconfig32
-rw-r--r--meson.build4
-rw-r--r--meson_options.txt1
-rwxr-xr-xscripts/gen-crashhandler-default-go.py40
-rw-r--r--src/crashhandler.cpp56
-rw-r--r--src/crashhandler.h30
-rw-r--r--src/crashhandler_dummy.cpp16
-rw-r--r--src/main.cpp13
-rw-r--r--src/meson.build7
-rw-r--r--src/wallet/wallet.cpp35
-rw-r--r--src/wallet/wallet.h18
-rw-r--r--tools/meson.build26
-rw-r--r--tools/src/crashhandler/defaults.go.in4
-rw-r--r--tools/src/crashhandler/main.go81
14 files changed, 0 insertions, 363 deletions
diff --git a/Kconfig b/Kconfig
index 37d3d9c..ed8dbdf 100644
--- a/Kconfig
+++ b/Kconfig
@@ -185,38 +185,6 @@ config session.path
string "Session location"
default "~/.config/smolbote/session.d"
-config USEPLASMA
- bool "Enable KDE Frameworks integration"
- default n
-
-menu "KDE Integration"
- depends on USEPLASMA
-
- config PLASMA_BLUR
- bool "Enable translucent background and blur behind window"
- default n
-
- config WALLET_FOLDER
- string "KDE Wallet folder name"
- default "smolbote"
-endmenu
-
-config USEBREAKPAD
- bool "Enable Breakpad integration"
- default n
-
-menu "Breakpad Integration"
- depends on USEBREAKPAD
-
- config PATH_CRASHDUMP
- string "Crash dump location"
- default "~/.config/smolbote/crash.d"
-
- config PATH_CRASHHANDLER
- string "Crash handler location"
- default "poi-crash"
-endmenu
-
menu "Workarounds"
config QTBUG_65223
bool "Manually emit loadFinished"
diff --git a/meson.build b/meson.build
index d12b130..2ae2941 100644
--- a/meson.build
+++ b/meson.build
@@ -88,10 +88,6 @@ dep_qt5 = dependency('qt5',
)
dep_spdlog = dependency('spdlog', fallback: ['spdlog', 'spdlog_dep'], version: '>=1.3.1')
-
-dep_breakpad = dependency('breakpad-client', include_type: 'system', required: get_option('crashhandler'))
-dep_threads = dependency('threads', include_type: 'system', required: get_option('crashhandler'))
-
dep_gtest = dependency('gtest', required: false, disabler: true)
dep_catch = dependency('catch2', required: true, fallback: ['catch2', 'catch2_dep'] )
dep_SingleApplication = dependency('singleapplication', fallback: [ 'singleapplication', 'SingleApplication_dep' ])
diff --git a/meson_options.txt b/meson_options.txt
index eb39c03..32c25cb 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -3,7 +3,6 @@ option('firejail', description: 'firejail executable name', type: 'string', va
option('manpage', description: 'Generate and install manpage', type: 'boolean', value: 'true')
option('translations', description: 'Generate and install translations', type: 'feature', value: 'auto')
-option('crashhandler', description: 'Enable breakpad crash reporting', type: 'feature', value: 'auto')
option('updater', description: 'Build updater component', type: 'feature', value: 'auto')
# Build options
diff --git a/scripts/gen-crashhandler-default-go.py b/scripts/gen-crashhandler-default-go.py
deleted file mode 100755
index e080ed9..0000000
--- a/scripts/gen-crashhandler-default-go.py
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env python3
-
-import sys
-import argparse
-import kconfiglib
-import re
-
-def findItem(node, name):
- while node:
- if isinstance(node.item, kconfiglib.Symbol):
- if node.item.name == name:
- return node.item.str_value
-
- if node.list:
- found = findItem(node.list, name)
- if found is not None:
- return found
-
- node = node.next
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser()
- parser.add_argument("--kconfig", nargs="?", default="Kconfig", help="Top-level Kconfig")
- parser.add_argument("--dotconfig", nargs="?", help=".config")
- parser.add_argument("--input", type=argparse.FileType('r'), help="default.go.in")
- parser.add_argument("--output", type=argparse.FileType('w'), default=sys.stdout, help="Output location")
- args = parser.parse_args()
-
- kconf = kconfiglib.Kconfig(args.kconfig)
- if args.dotconfig is not None:
- kconf.load_config(args.dotconfig)
-
- marker = re.compile('.+(@(\w+)@)')
- for line in args.input:
- found = marker.match(line)
- if found:
- print(str.replace(line, found.group(1), findItem(kconf.top_node, found.group(2))), end='', file=args.output)
- else:
- print(line, end='', file=args.output)
-
diff --git a/src/crashhandler.cpp b/src/crashhandler.cpp
deleted file mode 100644
index ed9298f..0000000
--- a/src/crashhandler.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "crashhandler.h"
-#include "version.h"
-#include <QByteArray>
-#include <client/linux/handler/exception_handler.h>
-#include <unistd.h>
-
-// bool filter_callback (void*)
-// --> true: continue processing and write a minidump
-static bool minidumpCb(const google_breakpad::MinidumpDescriptor &descriptor, void *context, bool succeeded)
-{
- printf("Dump path: %s\n", descriptor.path());
-
- auto *ctx = static_cast<CrashHandler::Context *>(context);
- if(ctx != nullptr) {
- if(!ctx->handler.empty()) {
- // fork and run 'handler master:commit path.dmp'
- pid_t pid = fork();
- if(pid == 0) {
- // pathname program argument ... nullptr
- execlp(ctx->handler.c_str(),
- ctx->handler.c_str(), "--crashd", ctx->dumppath.c_str(), "-c", descriptor.path(), poi_Version,
- (char *)nullptr);
- }
- }
- }
-
- return succeeded;
-}
-
-bool CrashHandler::install_handler(CrashHandler::Context &ctx)
-{
- if(ctx.dumppath.empty())
- return false;
-
- // Disable Chromium's crash handler so breakpad can capture crashes instead.
- // This has to be done before QtWebEngine gets initialized.
- const auto chromiumFlags = qgetenv("QTWEBENGINE_CHROMIUM_FLAGS");
- if(!chromiumFlags.contains("disable-in-process-stack-traces")) {
- qputenv("QTWEBENGINE_CHROMIUM_FLAGS", chromiumFlags + " --disable-in-process-stack-traces");
- }
-
- google_breakpad::MinidumpDescriptor descriptor(ctx.dumppath.c_str());
-
- // minidump descriptor, filter callback, minidump callback, callback_context, install handler, server_fd
- new google_breakpad::ExceptionHandler(descriptor, nullptr, minidumpCb, &ctx, true, -1);
-
- return true;
-}
diff --git a/src/crashhandler.h b/src/crashhandler.h
deleted file mode 100644
index 73b1768..0000000
--- a/src/crashhandler.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#ifndef SMOLBOTE_CRASHHANDLER_H
-#define SMOLBOTE_CRASHHANDLER_H
-
-#include <string>
-
-namespace CrashHandler
-{
-struct Context {
- const std::string dumppath;
- const std::string handler;
-
- explicit Context(const std::string &path, const std::string &crashhandler)
- : dumppath(path)
- , handler(crashhandler)
- {
- }
-};
-
-bool install_handler(Context &ctx);
-}
-
-#endif // SMOLBOTE_CRASHHANDLER_H
diff --git a/src/crashhandler_dummy.cpp b/src/crashhandler_dummy.cpp
deleted file mode 100644
index e230c82..0000000
--- a/src/crashhandler_dummy.cpp
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "crashhandler.h"
-
-
-bool CrashHandler::install_handler(CrashHandler::Context &)
-{
- return false;
-}
-
diff --git a/src/main.cpp b/src/main.cpp
index 3976f53..97b529b 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -9,7 +9,6 @@
#include "browser.h"
#include "builtins.h"
#include "configuration.h"
-#include "crashhandler.h"
#include "session/sessiondialog.h"
#include "session_json.hpp"
#include "settings.h"
@@ -95,18 +94,6 @@ int main(int argc, char **argv)
app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
{
- if(conf.ptr->value<bool>("usebreakpad").value()) {
- CrashHandler::Context ctx(
- conf.ptr->value<std::string>("path.crashdump").value(),
- conf.ptr->value<std::string>("path.crashhandler").value());
-
- if(CrashHandler::install_handler(ctx)) {
- spdlog::info("Installed breakpad crash handler: {}", ctx.dumppath);
- } else {
- spdlog::warn("Failed to install breakpad crash handler: {}", ctx.dumppath);
- }
- }
-
// load plugins
for(const QString &path : Util::files(conf.ptr->value<QString>("plugins.path").value(), { "*.so", "*.dll" })) {
if(app.loadPlugin(path)) {
diff --git a/src/meson.build b/src/meson.build
index 6a4abd8..aa98d61 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -47,14 +47,7 @@ poi_sourceset.add(files(
'subwindow/subwindow.cpp',
'subwindow/tabwidget.cpp',
-
- 'wallet/wallet.cpp', 'wallet/wallet.h'
),
version_h, poi_settings_h
)
-poi_sourceset.add(when: [dep_breakpad, dep_threads],
- if_true: files('crashhandler.cpp'),
- if_false: files('crashhandler_dummy.cpp')
-)
-
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
deleted file mode 100644
index 5023ea4..0000000
--- a/src/wallet/wallet.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#include "wallet.h"
-#include <QWebEngineView>
-#include <QWebEngineScript>
-
-void Wallet::autocompleteForm(QWebEngineView *view)
-{
- const auto findFormFunction = QLatin1String("index = undefined; for(var i = 0; i < document.forms.length; ++i) { if(document.forms[i].autocomplete) { index = i } }; index");
-
- view->page()->runJavaScript(findFormFunction, QWebEngineScript::ApplicationWorld, [view](const QVariant &v) {
- if(!v.isNull()) {
- const QString username = "test-username";
- const QString password = "test-password";
-
- auto autofillFunction = QString("inputs = document.forms[%1].getElementsByTagName('input');"
- "for(var i = 0; i < inputs.length; ++i) {"
- " if(inputs[i].type == 'username') { inputs[i].value='username' }"
- " else if(inputs[i].type == 'email') { inputs[i].value='%2' }"
- " else if(inputs[i].type == 'password') { inputs[i].value='%3' }"
- " else { inputs[i].value=inputs[i].type }"
- "}")
- .arg(v.toString(), username, password);
- // TODO
- // for page->url() get list of pairs type = value
- view->page()->runJavaScript(autofillFunction, QWebEngineScript::ApplicationWorld);
- }
- });
-}
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
deleted file mode 100644
index d2fdb71..0000000
--- a/src/wallet/wallet.h
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * This file is part of smolbote. It's copyrighted by the contributors recorded
- * in the version control history of the file, available from its original
- * location: https://neueland.iserlohn-fortress.net/gitea/aqua/smolbote
- *
- * SPDX-License-Identifier: GPL-3.0
- */
-
-#ifndef SMOLBOTE_WALLET_H
-#define SMOLBOTE_WALLET_H
-
-class QWebEngineView;
-
-namespace Wallet {
- void autocompleteForm(QWebEngineView *view);
-}
-
-#endif // SMOLBOTE_WALLET_H
diff --git a/tools/meson.build b/tools/meson.build
index fd1547e..7008eca 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -1,29 +1,3 @@
-if get_option('crashhandler').enabled() or get_option('updater').enabled()
- go = find_program('go', required: true)
- go_args = [ '-buildmode=pie' ]
-endif
-
-if get_option('crashhandler').enabled()
-
-# normally, you'd use configure_file to create this file, but that would only place it in build,
-# and go will refuse to build from files in two different directories
-meson.add_postconf_script(meson.source_root()/'scripts/gen-crashhandler-default-go.py',
- '--kconfig=' + meson.source_root()/'Kconfig',
- '--dotconfig=' + meson.source_root()/host_machine.system()/'.config',
- '--input=' + meson.current_source_dir()/'src/crashhandler/defaults.go.in',
- '--output=' + meson.current_source_dir()/'src/crashhandler/defaults.go'
-)
-
-custom_target('poi-crash',
- input: [ files('src/updater/main.go'), meson.current_source_dir()/'src/crashhandler/defaults.go' ],
- output: 'poi-crash',
- command: ['env', 'GOPATH='+meson.current_source_dir(), go, 'build', go_args, '-o=@OUTPUT@', 'crashhandler'],
- build_by_default: true,
- install: true,
- install_dir: get_option('bindir'),
-)
-endif
-
if get_option('updater').enabled()
custom_target('poi-update',
input: files('src/updater/main.go'),
diff --git a/tools/src/crashhandler/defaults.go.in b/tools/src/crashhandler/defaults.go.in
deleted file mode 100644
index 2ea5827..0000000
--- a/tools/src/crashhandler/defaults.go.in
+++ /dev/null
@@ -1,4 +0,0 @@
-package main
-
-var dumpPath = "@PATH_CRASHDUMP@"
-
diff --git a/tools/src/crashhandler/main.go b/tools/src/crashhandler/main.go
deleted file mode 100644
index 7b1717f..0000000
--- a/tools/src/crashhandler/main.go
+++ /dev/null
@@ -1,81 +0,0 @@
-package main
-
-import (
- "flag"
- "fmt"
- "io/ioutil"
- "os"
- "strings"
-)
-
-type CrashDump struct {
- Name string
- DumpPath string
- MetadataPath string
-}
-
-func expandHomeDir(path string) (string, error) {
- home, err := os.UserHomeDir()
- if err != nil {
- return path, err
- }
-
- return strings.Replace(path, "~/", home, -1), nil
-}
-
-func dumps(path string) ([]CrashDump, error) {
- files, err := ioutil.ReadDir(path)
- if err != nil {
- return nil, err
- }
-
- var crashes []CrashDump
-
- for i, file := range files {
- if strings.HasSuffix(file.Name(), ".dmp") {
- if i+1 < len(files) && files[i+1].Name() == file.Name()+".txt" {
- crashes = append(crashes, CrashDump{Name: strings.TrimSuffix(file.Name(), ".dmp"),
- DumpPath: file.Name(), MetadataPath: files[i+1].Name()})
- } else {
- crashes = append(crashes, CrashDump{Name: strings.TrimSuffix(file.Name(), ".dmp"), DumpPath: file.Name()})
- }
- }
- }
-
- return crashes, nil
-}
-
-func main() {
- helpFlag := flag.Bool("help", false, "Show help information.")
- flag.StringVar(&dumpPath, "crashd", dumpPath, "Crash dump path")
-
- // create crash report flags
- crashedFlag := flag.String("c", "", "Create crash report at specified location and write any specified data into it")
-
- flag.Parse()
- dumpPath, _ = expandHomeDir(dumpPath)
-
- if *helpFlag {
- flag.PrintDefaults()
- return
- }
-
- if *crashedFlag != "" {
- fmt.Println("Creating crash dump report", *crashedFlag)
- contents := []byte("Additional information: " + strings.Join(flag.Args(), ""))
- ioutil.WriteFile(*crashedFlag+".txt", contents, 0644)
- return
- }
-
- fmt.Printf(" [%s]\n", dumpPath)
- c, err := dumps(dumpPath)
- if err != nil {
- panic(err)
- }
- for _, d := range c {
- fmt.Printf("\t- %s\n", d.Name)
- }
- fmt.Println(" To analyze a crashdump, use the minidump_stackwalk tool:")
- fmt.Println("minidump_stackwalk <minidump-file> [symbol-path]")
-
-}