electron/patches/chromium/crash_allow_disabling_compression_on_linux.patch
electron-roller[bot] d32e6cc252
chore: bump chromium to 105.0.5173.0 (main) (#34770)
* chore: bump chromium in DEPS to 105.0.5147.0

* chore: update chromium/can_create_window.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3642216

fix minor code shear in patch

* chore: update chromium/port_autofill_colors_to_the_color_pipeline.patch

Xref: chromium/port_autofill_colors_to_the_color_pipeline.patch

fix minor code shear in patch

* chore: remove chromium/posix_replace_doubleforkandexec_with_forkandspawn.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3727368

Removing upstreamed patch

* chore: update patches

* chore: update patches

* chore: add new enum kOffscreenDocument to switch statement

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3722498

* chore: add stub for new parent virtual method OnNewCropVersion()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3717305

* chore: remove download_schedule arg from DownloadTargetCallback invocation

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3711096

Clean up DownloadLater flags and prefs

* chore: add stub for new parent virtual method OnNewCropVersion()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3717305

* chore: use base::List for extensions::Event

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3718366

Remove Event constructor overloads that take vector<base::Value>

* refactor: replace ClearStorageDataOptions.origin with .storage_key

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3702946

Refactor ClearData to take StorageKey

* chore: bump chromium in DEPS to 105.0.5149.0

* chore: update patches

* refactor: migrate InspectableWebContents to base::Value::List

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3726326

Migrate DevToolsEmbedderMessageDispatcher to base::Value::List.

* refactor: update electron_api_clipboard_mac Clipboard::ReadFindText()

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3721398

Mac: Remove unused FindPasteboard C++ interface

* chore: bump chromium in DEPS to 105.0.5151.0

* chore: fix code shear in chromium/build_do_not_depend_on_packed_resource_integrity.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3714995

Move Cart DB proto to //components/commerce

* Revert "chore: fix code shear in chromium/build_do_not_depend_on_packed_resource_integrity.patch"

This reverts commit f8de4605eb3d35152b186646fefd8e88d1df836b.

* chore: fix code shear in chromium/build_do_not_depend_on_packed_resource_integrity.patch

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3714995

Move Cart DB proto to //components/commerce

* chore: update patches

* chore: update ElectronAccessibilityUIMessageHandler to use base::Value::List

Xref: https://chromium-review.googlesource.com/c/chromium/src/+/3733367

Convert /chrome/browser/accessibility away from WebUI::RegisterDeprecatedMessageCallback

* chore: bump chromium in DEPS to 105.0.5153.0

* chore: bump chromium in DEPS to 105.0.5155.0

* chore: bump chromium in DEPS to 105.0.5157.0

* chore: bump chromium in DEPS to 105.0.5159.0

* chore: update patches

* chore: update CL reference

* Replace ContentMainDelegate::InvokedIn with a variant

https://chromium-review.googlesource.com/c/chromium/src/+/3705957

* Switch devtools_frontend.mojom to mojom.DictValue.

https://chromium-review.googlesource.com/c/chromium/src/+/3726425

* webhid: Bind HID service with service workers

https://chromium-review.googlesource.com/c/chromium/src/+/3680562

* chore: fix lint

* Don't fire load-complete AX notification on macOS for unfocused windows

https://chromium-review.googlesource.com/c/chromium/src/+/3695403

* chore: update patches

* chore: bump chromium in DEPS to 105.0.5165.0

* chore: update patches

* chore: bump chromium in DEPS to 105.0.5167.0

* chore: bump chromium in DEPS to 105.0.5169.0

* chore: bump chromium in DEPS to 105.0.5171.0

* chore: update patches

* chore: bump chromium in DEPS to 105.0.5173.0

* chore: update patches

* 3743346: Stop generating unsupported policies on macOS

https://chromium-review.googlesource.com/c/chromium/src/+/3743346

* 3727612: [Bluetooth][Win] Refactor pairing prompt code

https://chromium-review.googlesource.com/c/chromium/src/+/3727612

* 3737325: system-extensions: Move IsEnabled() out of SystemExtensionsProvider.

https://chromium-review.googlesource.com/c/chromium/src/+/3737325

* 3748635: Remove RenderView from the public API.

https://chromium-review.googlesource.com/c/chromium/src/+/3748635

* fixup: 3743346: Stop generating unsupported policies on macOS

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
Co-authored-by: deepak1556 <hop2deep@gmail.com>
Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org>
2022-07-13 17:26:16 -04:00

147 lines
5.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jeremy Apthorp <jeremya@chromium.org>
Date: Thu, 14 May 2020 16:52:09 -0700
Subject: crash: allow disabling compression on linux
This makes compression optional on breakpad_linux.
Upstream attempted here
https://chromium-review.googlesource.com/c/chromium/src/+/2198641, but
was denied.
Ultimately we should remove the option to disable compression, and
subsequently remove this patch.
diff --git a/components/crash/core/app/breakpad_linux.cc b/components/crash/core/app/breakpad_linux.cc
index 62d15f57e4c5a0a24aa730e8979fb1e9537fecd3..77fd14f5e9a4330364da4e7e5ee089c9196b4939 100644
--- a/components/crash/core/app/breakpad_linux.cc
+++ b/components/crash/core/app/breakpad_linux.cc
@@ -111,6 +111,8 @@ void SetUploadURL(const std::string& url) {
DCHECK(!g_upload_url);
g_upload_url = strdup(url.c_str());
}
+
+bool g_compress_uploads = true;
#endif
bool g_is_node = false;
@@ -1324,56 +1326,60 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
#else // BUILDFLAG(IS_CHROMEOS)
- // Compress |dumpfile| with gzip.
- const pid_t gzip_child = sys_fork();
- if (gzip_child < 0) {
- static const char msg[] = "sys_fork() for gzip process failed.\n";
- WriteLog(msg, sizeof(msg) - 1);
- sys__exit(1);
- }
- if (!gzip_child) {
- // gzip process.
- const char* args[] = {
- "/bin/gzip",
- "-f", // Do not prompt to verify before overwriting.
- dumpfile,
- nullptr,
- };
- execve(args[0], const_cast<char**>(args), environ);
- static const char msg[] = "Cannot exec gzip.\n";
- WriteLog(msg, sizeof(msg) - 1);
- sys__exit(1);
- }
- // Wait for gzip process.
- int status = 0;
- if (sys_waitpid(gzip_child, &status, 0) != gzip_child ||
- !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
- static const char msg[] = "sys_waitpid() for gzip process failed.\n";
- WriteLog(msg, sizeof(msg) - 1);
- sys_kill(gzip_child, SIGKILL);
- sys__exit(1);
- }
+ if (g_compress_uploads) {
+ // Compress |dumpfile| with gzip.
+ const pid_t gzip_child = sys_fork();
+ if (gzip_child < 0) {
+ static const char msg[] = "sys_fork() for gzip process failed.\n";
+ WriteLog(msg, sizeof(msg) - 1);
+ sys__exit(1);
+ }
+ if (!gzip_child) {
+ // gzip process.
+ const char* args[] = {
+ "/bin/gzip",
+ "-f", // Do not prompt to verify before overwriting.
+ dumpfile,
+ nullptr,
+ };
+ execve(args[0], const_cast<char**>(args), environ);
+ static const char msg[] = "Cannot exec gzip.\n";
+ WriteLog(msg, sizeof(msg) - 1);
+ sys__exit(1);
+ }
+ // Wait for gzip process.
+ int status = 0;
+ if (sys_waitpid(gzip_child, &status, 0) != gzip_child ||
+ !WIFEXITED(status) || WEXITSTATUS(status) != 0) {
+ static const char msg[] = "sys_waitpid() for gzip process failed.\n";
+ WriteLog(msg, sizeof(msg) - 1);
+ sys_kill(gzip_child, SIGKILL);
+ sys__exit(1);
+ }
- static const char kGzipExtension[] = ".gz";
- const size_t gzip_file_size = my_strlen(dumpfile) + sizeof(kGzipExtension);
- char* const gzip_file = reinterpret_cast<char*>(allocator->Alloc(
- gzip_file_size));
- my_strlcpy(gzip_file, dumpfile, gzip_file_size);
- my_strlcat(gzip_file, kGzipExtension, gzip_file_size);
+ static const char kGzipExtension[] = ".gz";
+ const size_t gzip_file_size = my_strlen(dumpfile) + sizeof(kGzipExtension);
+ char* const gzip_file =
+ reinterpret_cast<char*>(allocator->Alloc(gzip_file_size));
+ my_strlcpy(gzip_file, dumpfile, gzip_file_size);
+ my_strlcat(gzip_file, kGzipExtension, gzip_file_size);
- // Rename |gzip_file| to |dumpfile| (the original file was deleted by gzip).
- if (rename(gzip_file, dumpfile)) {
- static const char msg[] = "Failed to rename gzipped file.\n";
- WriteLog(msg, sizeof(msg) - 1);
- sys__exit(1);
+ // Rename |gzip_file| to |dumpfile| (the original file was deleted by gzip).
+ if (rename(gzip_file, dumpfile)) {
+ static const char msg[] = "Failed to rename gzipped file.\n";
+ WriteLog(msg, sizeof(msg) - 1);
+ sys__exit(1);
+ }
}
// The --header argument to wget looks like:
// --header=Content-Encoding: gzip
// --header=Content-Type: multipart/form-data; boundary=XYZ
// where the boundary has two fewer leading '-' chars
- static const char header_content_encoding[] =
+ static const char header_content_encoding_gzip[] =
"--header=Content-Encoding: gzip";
+ static const char header_content_encoding_identity[] =
+ "--header=Content-Encoding: identity";
static const char header_msg[] =
"--header=Content-Type: multipart/form-data; boundary=";
const size_t header_content_type_size =
@@ -1400,7 +1406,8 @@ void ExecUploadProcessOrTerminate(const BreakpadInfo& info,
static const char kWgetBinary[] = "/usr/bin/wget";
const char* args[] = {
kWgetBinary,
- header_content_encoding,
+ g_compress_uploads ? header_content_encoding_gzip
+ : header_content_encoding_identity,
header_content_type,
post_file,
g_upload_url,
@@ -2041,6 +2048,7 @@ void InitCrashReporter(const std::string& process_type) {
#if !BUILDFLAG(IS_CHROMEOS)
SetUploadURL(GetCrashReporterClient()->GetUploadUrl());
+ g_compress_uploads = GetCrashReporterClient()->GetShouldCompressUploads();
#endif
if (is_browser_process) {