From 5bf2f4aef57f6a474f35b92ef25f6ad1b3c72b1c Mon Sep 17 00:00:00 2001 From: robert Date: Sun, 29 Jan 2023 11:31:00 +0000 Subject: [PATCH] there is no need to call XGetErrorDatabaseText() to cache the XErrorDB anymore so remove it for now --- www/chromium/Makefile | 2 +- ...-sandbox_policy_freebsd_sandbox_freebsd_cc | 14 +------ ...-sandbox_policy_openbsd_sandbox_openbsd_cc | 14 +------ www/iridium/Makefile | 2 +- ...-sandbox_policy_freebsd_sandbox_freebsd_cc | 32 +++++---------- ...-sandbox_policy_openbsd_sandbox_openbsd_cc | 40 +++++++------------ www/ungoogled-chromium/Makefile | 2 +- ...-sandbox_policy_freebsd_sandbox_freebsd_cc | 32 +++++---------- ...-sandbox_policy_openbsd_sandbox_openbsd_cc | 40 +++++++------------ 9 files changed, 53 insertions(+), 125 deletions(-) diff --git a/www/chromium/Makefile b/www/chromium/Makefile index 6c2e40329bd..2d270304562 100644 --- a/www/chromium/Makefile +++ b/www/chromium/Makefile @@ -7,7 +7,7 @@ DPB_PROPERTIES= parallel parallel2 COMMENT= Chromium browser V= 109.0.5414.119 -REVISION= 1 +REVISION= 2 DISTNAME= chromium-${V} diff --git a/www/chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc b/www/chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc index 55b7dd58e5c..ae6a0906e69 100644 --- a/www/chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc +++ b/www/chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc @@ -1,7 +1,7 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc --- sandbox/policy/freebsd/sandbox_freebsd.cc.orig +++ sandbox/policy/freebsd/sandbox_freebsd.cc -@@ -0,0 +1,253 @@ +@@ -0,0 +1,241 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -61,11 +61,8 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc +#include "crypto/nss_util.h" +#endif + -+#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + -+#include -+ +#define MAXTOKENS 3 + +#define _UNVEIL_MAIN "/etc/chromium/unveil.main"; @@ -126,15 +123,6 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc + crypto::EnsureNSSInit(); +#endif + -+ // cache the XErrorDB by forcing a read on it -+ { -+ auto* connection = x11::Connection::Get(); -+ auto* display = connection->GetXlibDisplay().display(); -+ -+ char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); -+ } -+ + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + diff --git a/www/chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc b/www/chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc index 503cc1c9efc..8ad363351ea 100644 --- a/www/chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc +++ b/www/chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc @@ -1,7 +1,7 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc --- sandbox/policy/openbsd/sandbox_openbsd.cc.orig +++ sandbox/policy/openbsd/sandbox_openbsd.cc -@@ -0,0 +1,413 @@ +@@ -0,0 +1,401 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -64,11 +64,8 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + +#include "third_party/boringssl/src/include/openssl/crypto.h" + -+#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + -+#include -+ +#define MAXTOKENS 3 + +#define _UNVEIL_MAIN "/etc/chromium/unveil.main"; @@ -134,15 +131,6 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + if (process_type.empty()) + CRYPTO_pre_sandbox_init(); + -+ // cache the XErrorDB by forcing a read on it -+ { -+ auto* connection = x11::Connection::Get(); -+ auto* display = connection->GetXlibDisplay().display(); -+ -+ char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); -+ } -+ + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + diff --git a/www/iridium/Makefile b/www/iridium/Makefile index dbf377df9ca..dbbfd050c18 100644 --- a/www/iridium/Makefile +++ b/www/iridium/Makefile @@ -12,7 +12,7 @@ COMMENT= Iridium browser V= 2023.01.109 -REVISION= 5 +REVISION= 6 DISTNAME= iridium-browser-${V} PKGNAME= iridium-${V} diff --git a/www/iridium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc b/www/iridium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc index 61dbab33677..ae6a0906e69 100644 --- a/www/iridium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc +++ b/www/iridium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc @@ -1,7 +1,7 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc --- sandbox/policy/freebsd/sandbox_freebsd.cc.orig +++ sandbox/policy/freebsd/sandbox_freebsd.cc -@@ -0,0 +1,253 @@ +@@ -0,0 +1,241 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -61,21 +61,18 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc +#include "crypto/nss_util.h" +#endif + -+#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + -+#include -+ +#define MAXTOKENS 3 + -+#define _UNVEIL_MAIN "/etc/iridium/unveil.main"; -+#define _UNVEIL_RENDERER "/etc/iridium/unveil.renderer"; -+#define _UNVEIL_GPU "/etc/iridium/unveil.gpu"; -+#define _UNVEIL_PLUGIN "/etc/iridium/unveil.plugin"; -+#define _UNVEIL_UTILITY "/etc/iridium/unveil.utility"; -+#define _UNVEIL_UTILITY_NETWORK "/etc/iridium/unveil.utility_network"; -+#define _UNVEIL_UTILITY_AUDIO "/etc/iridium/unveil.utility_audio"; -+#define _UNVEIL_UTILITY_VIDEO "/etc/iridium/unveil.utility_video"; ++#define _UNVEIL_MAIN "/etc/chromium/unveil.main"; ++#define _UNVEIL_RENDERER "/etc/chromium/unveil.renderer"; ++#define _UNVEIL_GPU "/etc/chromium/unveil.gpu"; ++#define _UNVEIL_PLUGIN "/etc/chromium/unveil.plugin"; ++#define _UNVEIL_UTILITY "/etc/chromium/unveil.utility"; ++#define _UNVEIL_UTILITY_NETWORK "/etc/chromium/unveil.utility_network"; ++#define _UNVEIL_UTILITY_AUDIO "/etc/chromium/unveil.utility_audio"; ++#define _UNVEIL_UTILITY_VIDEO "/etc/chromium/unveil.utility_video"; + +namespace sandbox { +namespace policy { @@ -126,22 +123,13 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc + crypto::EnsureNSSInit(); +#endif + -+ // cache the XErrorDB by forcing a read on it -+ { -+ auto* connection = x11::Connection::Get(); -+ auto* display = connection->GetXlibDisplay().display(); -+ -+ char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); -+ } -+ + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + + base::PathService::Get(base::DIR_CACHE, &cache_directory); + base::PathService::Get(base::DIR_HOME, &local_directory); + -+ cache_directory = cache_directory.AppendASCII("iridium"); ++ cache_directory = cache_directory.AppendASCII("chromium"); + local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); + + if (!base::CreateDirectory(cache_directory)) { diff --git a/www/iridium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc b/www/iridium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc index b91af5238e3..8ad363351ea 100644 --- a/www/iridium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc +++ b/www/iridium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc @@ -1,7 +1,7 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc --- sandbox/policy/openbsd/sandbox_openbsd.cc.orig +++ sandbox/policy/openbsd/sandbox_openbsd.cc -@@ -0,0 +1,413 @@ +@@ -0,0 +1,401 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -64,21 +64,18 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + +#include "third_party/boringssl/src/include/openssl/crypto.h" + -+#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + -+#include -+ +#define MAXTOKENS 3 + -+#define _UNVEIL_MAIN "/etc/iridium/unveil.main"; -+#define _UNVEIL_RENDERER "/etc/iridium/unveil.renderer"; -+#define _UNVEIL_GPU "/etc/iridium/unveil.gpu"; -+#define _UNVEIL_PLUGIN "/etc/iridium/unveil.plugin"; -+#define _UNVEIL_UTILITY "/etc/iridium/unveil.utility"; -+#define _UNVEIL_UTILITY_NETWORK "/etc/iridium/unveil.utility_network"; -+#define _UNVEIL_UTILITY_AUDIO "/etc/iridium/unveil.utility_audio"; -+#define _UNVEIL_UTILITY_VIDEO "/etc/iridium/unveil.utility_video"; ++#define _UNVEIL_MAIN "/etc/chromium/unveil.main"; ++#define _UNVEIL_RENDERER "/etc/chromium/unveil.renderer"; ++#define _UNVEIL_GPU "/etc/chromium/unveil.gpu"; ++#define _UNVEIL_PLUGIN "/etc/chromium/unveil.plugin"; ++#define _UNVEIL_UTILITY "/etc/chromium/unveil.utility"; ++#define _UNVEIL_UTILITY_NETWORK "/etc/chromium/unveil.utility_network"; ++#define _UNVEIL_UTILITY_AUDIO "/etc/chromium/unveil.utility_audio"; ++#define _UNVEIL_UTILITY_VIDEO "/etc/chromium/unveil.utility_video"; + +namespace sandbox { +namespace policy { @@ -134,22 +131,13 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + if (process_type.empty()) + CRYPTO_pre_sandbox_init(); + -+ // cache the XErrorDB by forcing a read on it -+ { -+ auto* connection = x11::Connection::Get(); -+ auto* display = connection->GetXlibDisplay().display(); -+ -+ char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); -+ } -+ + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + + base::PathService::Get(base::DIR_CACHE, &cache_directory); + base::PathService::Get(base::DIR_HOME, &local_directory); + -+ cache_directory = cache_directory.AppendASCII("iridium"); ++ cache_directory = cache_directory.AppendASCII("chromium"); + local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); + + if (!base::CreateDirectory(cache_directory)) { @@ -325,7 +313,7 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + if (process_type.empty()) { + // XXX use a file for listing pledges of the main process for now + // XXX not having the file is not a fatal error -+ SetPledge(NULL, "/etc/iridium/pledge.main"); ++ SetPledge(NULL, "/etc/chromium/pledge.main"); + } else if (process_type == switches::kRendererProcess) { + // prot_exec needed by v8 + // flock needed by sqlite3 locking @@ -337,11 +325,11 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + SetPledge("stdio rpath prot_exec recvfd sendfd", NULL); + } else if (process_type == switches::kUtilityProcess) { + if (sandbox_type == sandbox::mojom::Sandbox::kAudio) -+ SetPledge(NULL, "/etc/iridium/pledge.utility_audio"); ++ SetPledge(NULL, "/etc/chromium/pledge.utility_audio"); + else if (sandbox_type == sandbox::mojom::Sandbox::kNetwork) -+ SetPledge(NULL, "/etc/iridium/pledge.utility_network"); ++ SetPledge(NULL, "/etc/chromium/pledge.utility_network"); + else if (sandbox_type == sandbox::mojom::Sandbox::kVideoCapture) -+ SetPledge(NULL, "/etc/iridium/pledge.utility_video"); ++ SetPledge(NULL, "/etc/chromium/pledge.utility_video"); + else + SetPledge("stdio rpath cpath wpath fattr flock sendfd recvfd prot_exec", NULL); + } else { diff --git a/www/ungoogled-chromium/Makefile b/www/ungoogled-chromium/Makefile index 0bc36b3fa71..6855822ca99 100644 --- a/www/ungoogled-chromium/Makefile +++ b/www/ungoogled-chromium/Makefile @@ -10,7 +10,7 @@ COMMENT= Chromium browser sans integration with Google V= 109.0.5414.119 UGV= ${V}-1 -REVISION= 1 +REVISION= 2 DISTNAME= ungoogled-chromium-${V} diff --git a/www/ungoogled-chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc b/www/ungoogled-chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc index 5d63b73f514..ae6a0906e69 100644 --- a/www/ungoogled-chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc +++ b/www/ungoogled-chromium/patches/patch-sandbox_policy_freebsd_sandbox_freebsd_cc @@ -1,7 +1,7 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc --- sandbox/policy/freebsd/sandbox_freebsd.cc.orig +++ sandbox/policy/freebsd/sandbox_freebsd.cc -@@ -0,0 +1,253 @@ +@@ -0,0 +1,241 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -61,21 +61,18 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc +#include "crypto/nss_util.h" +#endif + -+#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + -+#include -+ +#define MAXTOKENS 3 + -+#define _UNVEIL_MAIN "/etc/ungoogled-chromium/unveil.main"; -+#define _UNVEIL_RENDERER "/etc/ungoogled-chromium/unveil.renderer"; -+#define _UNVEIL_GPU "/etc/ungoogled-chromium/unveil.gpu"; -+#define _UNVEIL_PLUGIN "/etc/ungoogled-chromium/unveil.plugin"; -+#define _UNVEIL_UTILITY "/etc/ungoogled-chromium/unveil.utility"; -+#define _UNVEIL_UTILITY_NETWORK "/etc/ungoogled-chromium/unveil.utility_network"; -+#define _UNVEIL_UTILITY_AUDIO "/etc/ungoogled-chromium/unveil.utility_audio"; -+#define _UNVEIL_UTILITY_VIDEO "/etc/ungoogled-chromium/unveil.utility_video"; ++#define _UNVEIL_MAIN "/etc/chromium/unveil.main"; ++#define _UNVEIL_RENDERER "/etc/chromium/unveil.renderer"; ++#define _UNVEIL_GPU "/etc/chromium/unveil.gpu"; ++#define _UNVEIL_PLUGIN "/etc/chromium/unveil.plugin"; ++#define _UNVEIL_UTILITY "/etc/chromium/unveil.utility"; ++#define _UNVEIL_UTILITY_NETWORK "/etc/chromium/unveil.utility_network"; ++#define _UNVEIL_UTILITY_AUDIO "/etc/chromium/unveil.utility_audio"; ++#define _UNVEIL_UTILITY_VIDEO "/etc/chromium/unveil.utility_video"; + +namespace sandbox { +namespace policy { @@ -126,22 +123,13 @@ Index: sandbox/policy/freebsd/sandbox_freebsd.cc + crypto::EnsureNSSInit(); +#endif + -+ // cache the XErrorDB by forcing a read on it -+ { -+ auto* connection = x11::Connection::Get(); -+ auto* display = connection->GetXlibDisplay().display(); -+ -+ char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); -+ } -+ + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + + base::PathService::Get(base::DIR_CACHE, &cache_directory); + base::PathService::Get(base::DIR_HOME, &local_directory); + -+ cache_directory = cache_directory.AppendASCII("ungoogled-chromium"); ++ cache_directory = cache_directory.AppendASCII("chromium"); + local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); + + if (!base::CreateDirectory(cache_directory)) { diff --git a/www/ungoogled-chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc b/www/ungoogled-chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc index 53095c7b7de..8ad363351ea 100644 --- a/www/ungoogled-chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc +++ b/www/ungoogled-chromium/patches/patch-sandbox_policy_openbsd_sandbox_openbsd_cc @@ -1,7 +1,7 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc --- sandbox/policy/openbsd/sandbox_openbsd.cc.orig +++ sandbox/policy/openbsd/sandbox_openbsd.cc -@@ -0,0 +1,413 @@ +@@ -0,0 +1,401 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. @@ -64,21 +64,18 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + +#include "third_party/boringssl/src/include/openssl/crypto.h" + -+#include "ui/gfx/x/connection.h" +#include "ui/gfx/font_util.h" + -+#include -+ +#define MAXTOKENS 3 + -+#define _UNVEIL_MAIN "/etc/ungoogled-chromium/unveil.main"; -+#define _UNVEIL_RENDERER "/etc/ungoogled-chromium/unveil.renderer"; -+#define _UNVEIL_GPU "/etc/ungoogled-chromium/unveil.gpu"; -+#define _UNVEIL_PLUGIN "/etc/ungoogled-chromium/unveil.plugin"; -+#define _UNVEIL_UTILITY "/etc/ungoogled-chromium/unveil.utility"; -+#define _UNVEIL_UTILITY_NETWORK "/etc/ungoogled-chromium/unveil.utility_network"; -+#define _UNVEIL_UTILITY_AUDIO "/etc/ungoogled-chromium/unveil.utility_audio"; -+#define _UNVEIL_UTILITY_VIDEO "/etc/ungoogled-chromium/unveil.utility_video"; ++#define _UNVEIL_MAIN "/etc/chromium/unveil.main"; ++#define _UNVEIL_RENDERER "/etc/chromium/unveil.renderer"; ++#define _UNVEIL_GPU "/etc/chromium/unveil.gpu"; ++#define _UNVEIL_PLUGIN "/etc/chromium/unveil.plugin"; ++#define _UNVEIL_UTILITY "/etc/chromium/unveil.utility"; ++#define _UNVEIL_UTILITY_NETWORK "/etc/chromium/unveil.utility_network"; ++#define _UNVEIL_UTILITY_AUDIO "/etc/chromium/unveil.utility_audio"; ++#define _UNVEIL_UTILITY_VIDEO "/etc/chromium/unveil.utility_video"; + +namespace sandbox { +namespace policy { @@ -134,22 +131,13 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + if (process_type.empty()) + CRYPTO_pre_sandbox_init(); + -+ // cache the XErrorDB by forcing a read on it -+ { -+ auto* connection = x11::Connection::Get(); -+ auto* display = connection->GetXlibDisplay().display(); -+ -+ char buf[1]; -+ XGetErrorDatabaseText(display, "XProtoError", "0", "", buf, std::size(buf)); -+ } -+ + if (process_type.empty()) { + base::FilePath cache_directory, local_directory; + + base::PathService::Get(base::DIR_CACHE, &cache_directory); + base::PathService::Get(base::DIR_HOME, &local_directory); + -+ cache_directory = cache_directory.AppendASCII("ungoogled-chromium"); ++ cache_directory = cache_directory.AppendASCII("chromium"); + local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); + + if (!base::CreateDirectory(cache_directory)) { @@ -325,7 +313,7 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + if (process_type.empty()) { + // XXX use a file for listing pledges of the main process for now + // XXX not having the file is not a fatal error -+ SetPledge(NULL, "/etc/ungoogled-chromium/pledge.main"); ++ SetPledge(NULL, "/etc/chromium/pledge.main"); + } else if (process_type == switches::kRendererProcess) { + // prot_exec needed by v8 + // flock needed by sqlite3 locking @@ -337,11 +325,11 @@ Index: sandbox/policy/openbsd/sandbox_openbsd.cc + SetPledge("stdio rpath prot_exec recvfd sendfd", NULL); + } else if (process_type == switches::kUtilityProcess) { + if (sandbox_type == sandbox::mojom::Sandbox::kAudio) -+ SetPledge(NULL, "/etc/ungoogled-chromium/pledge.utility_audio"); ++ SetPledge(NULL, "/etc/chromium/pledge.utility_audio"); + else if (sandbox_type == sandbox::mojom::Sandbox::kNetwork) -+ SetPledge(NULL, "/etc/ungoogled-chromium/pledge.utility_network"); ++ SetPledge(NULL, "/etc/chromium/pledge.utility_network"); + else if (sandbox_type == sandbox::mojom::Sandbox::kVideoCapture) -+ SetPledge(NULL, "/etc/ungoogled-chromium/pledge.utility_video"); ++ SetPledge(NULL, "/etc/chromium/pledge.utility_video"); + else + SetPledge("stdio rpath cpath wpath fattr flock sendfd recvfd prot_exec", NULL); + } else {