From ecf81ba16e69736f11976b4b52d239df944cadb4 Mon Sep 17 00:00:00 2001 From: robert Date: Sun, 6 Jan 2019 19:49:53 +0000 Subject: [PATCH] pre-create the .cache/chromium and .local/share/applications directories so that unveil will not fail on them if they do not exist yet --- www/chromium/Makefile | 4 ++-- www/chromium/files/unveil.main | 4 ++-- ...manager_sandbox_openbsd_sandbox_openbsd_cc | 23 ++++++++++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/www/chromium/Makefile b/www/chromium/Makefile index 287241b3a63..b9ec5df4179 100644 --- a/www/chromium/Makefile +++ b/www/chromium/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.403 2019/01/04 13:25:08 robert Exp $ +# $OpenBSD: Makefile,v 1.404 2019/01/06 19:49:53 robert Exp $ .include @@ -10,7 +10,7 @@ COMMENT= Chromium browser V= 71.0.3578.98 -REVISION= 1 +REVISION= 2 DISTNAME= chromium-${V} diff --git a/www/chromium/files/unveil.main b/www/chromium/files/unveil.main index 1a2db6603e0..522b14e5ee7 100644 --- a/www/chromium/files/unveil.main +++ b/www/chromium/files/unveil.main @@ -1,4 +1,4 @@ -# $OpenBSD: unveil.main,v 1.5 2018/12/25 17:32:43 robert Exp $ +# $OpenBSD: unveil.main,v 1.6 2019/01/06 19:49:53 robert Exp $ # needed for chromium /etc/chromium r @@ -60,7 +60,7 @@ ~/.config/mimeapps.list r ~/.config/user-dirs.dirs r -~/.local/share/applications r +~/.local/share/applications rwc ~/.local/share/applnk r ~/.local/share/fonts r ~/.local/share/glib-2.0 r diff --git a/www/chromium/patches/patch-services_service_manager_sandbox_openbsd_sandbox_openbsd_cc b/www/chromium/patches/patch-services_service_manager_sandbox_openbsd_sandbox_openbsd_cc index bc7713944ce..9f26cf2e3a5 100644 --- a/www/chromium/patches/patch-services_service_manager_sandbox_openbsd_sandbox_openbsd_cc +++ b/www/chromium/patches/patch-services_service_manager_sandbox_openbsd_sandbox_openbsd_cc @@ -1,7 +1,7 @@ Index: services/service_manager/sandbox/openbsd/sandbox_openbsd.cc --- services/service_manager/sandbox/openbsd/sandbox_openbsd.cc.orig +++ services/service_manager/sandbox/openbsd/sandbox_openbsd.cc -@@ -0,0 +1,292 @@ +@@ -0,0 +1,313 @@ +// 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. @@ -28,10 +28,13 @@ Index: services/service_manager/sandbox/openbsd/sandbox_openbsd.cc +#include "base/command_line.h" +#include "base/debug/stack_trace.h" +#include "base/feature_list.h" ++#include "base/files/file_path.h" ++#include "base/files/file_util.h" +#include "base/files/scoped_file.h" +#include "base/logging.h" +#include "base/macros.h" +#include "base/memory/singleton.h" ++#include "base/path_service.h" +#include "base/posix/eintr_wrapper.h" +#include "base/strings/string_number_conversions.h" +#include "base/sys_info.h" @@ -108,6 +111,24 @@ Index: services/service_manager/sandbox/openbsd/sandbox_openbsd.cc + crypto::EnsureNSSInit(); +#endif + ++ 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("chromium"); ++ local_directory = local_directory.AppendASCII(".local").AppendASCII("share").AppendASCII("applications"); ++ ++ if (!base::CreateDirectory(cache_directory)) { ++ LOG(ERROR) << "Failed to create " << cache_directory.value() << " directory."; ++ } ++ ++ if (!base::CreateDirectory(local_directory)) { ++ LOG(ERROR) << "Failed to create " << local_directory.value() << " directory."; ++ } ++ } ++ + if (!command_line->HasSwitch(switches::kDisableUnveil)) + SetUnveil(process_type); +