diff options
Diffstat (limited to 'xdg-basedir.patch')
-rw-r--r-- | xdg-basedir.patch | 84 |
1 files changed, 84 insertions, 0 deletions
diff --git a/xdg-basedir.patch b/xdg-basedir.patch new file mode 100644 index 000000000000..cf3181577703 --- /dev/null +++ b/xdg-basedir.patch @@ -0,0 +1,84 @@ +diff -ruN a/base/nix/xdg_util.cc b/base/nix/xdg_util.cc +--- a/base/nix/xdg_util.cc 2021-10-01 03:36:37.000000000 +0200 ++++ b/base/nix/xdg_util.cc 2021-10-11 23:38:26.553638013 +0200 +@@ -29,6 +29,8 @@ + const char kXdgConfigHomeEnvVar[] = "XDG_CONFIG_HOME"; + const char kXdgCurrentDesktopEnvVar[] = "XDG_CURRENT_DESKTOP"; + const char kXdgSessionTypeEnvVar[] = "XDG_SESSION_TYPE"; ++const char kDotDataDir[] = ".local/share"; ++const char kXdgDataHomeEnvVar[] = "XDG_DATA_HOME"; + + FilePath GetXDGDirectory(Environment* env, const char* env_name, + const char* fallback_dir) { + +diff -ruN a/base/nix/xdg_util.h b/base/nix/xdg_util.h +--- a/base/nix/xdg_util.h 2021-10-11 23:57:48.607012470 +0200 ++++ b/base/nix/xdg_util.h 2021-10-12 00:04:46.457027239 +0200 +@@ -37,6 +37,12 @@ + // The XDG session type environment variable. + BASE_EXPORT extern const char kXdgSessionTypeEnvVar[]; + ++// The default XDG data directory name. ++BASE_EXPORT extern const char kDotDataDir[]; ++ ++// The XDG data directory environment variable. ++BASE_EXPORT extern const char kXdgDataHomeEnvVar[]; ++ + // Utility function for getting XDG directories. + // |env_name| is the name of an environment variable that we want to use to get + // a directory path. |fallback_dir| is the directory relative to $HOME that we + +diff -ruN a/crypto/nss_util.cc b/crypto/nss_util.cc +--- a/crypto/nss_util.cc 2021-10-01 03:36:49.000000000 +0200 ++++ b/crypto/nss_util.cc 2021-10-12 12:45:52.235119130 +0200 +@@ -30,6 +30,9 @@ + #include "build/chromeos_buildflags.h" + #include "crypto/nss_crypto_module_delegate.h" + #include "crypto/nss_util_internal.h" ++#include "base/environment.h" ++#include "base/nix/xdg_util.h" ++#include "chrome/common/chrome_constants.h" + + namespace crypto { + +@@ -45,12 +48,21 @@ + + base::FilePath GetDefaultConfigDirectory() { + base::FilePath dir; ++#if defined(OS_LINUX) ++ std::unique_ptr<base::Environment> env(base::Environment::Create()); ++ dir = base::nix::GetXDGDirectory(env.get(), base::nix::kXdgDataHomeEnvVar, base::nix::kDotDataDir); ++#else + base::PathService::Get(base::DIR_HOME, &dir); ++#endif + if (dir.empty()) { +- LOG(ERROR) << "Failed to get home directory."; ++ LOG(ERROR) << "Failed to get $HOME or $XDG_DATA_HOME directory."; + return dir; + } ++#if defined(OS_LINUX) ++ dir = dir.Append(chrome::kBrowserProcessExecutableName).AppendASCII("pki").AppendASCII("nssdb"); ++#else + dir = dir.AppendASCII(".pki").AppendASCII("nssdb"); ++#endif + if (!base::CreateDirectory(dir)) { + LOG(ERROR) << "Failed to create " << dir.value() << " directory."; + dir.clear(); +@@ -136,7 +148,7 @@ + NSSInitSingleton() { + // Initializing NSS causes us to do blocking IO. + // Temporarily allow it until we fix +- // http://code.google.com/p/chromium/issues/detail?id=59847 ++ // http://code.9oo91e.qjz9zk/p/chromium/issues/detail?id=59847 + base::ThreadRestrictions::ScopedAllowIO allow_io; + + EnsureNSPRInit(); +@@ -273,7 +285,7 @@ + + // Shouldn't need to const_cast here, but SECMOD doesn't properly declare + // input string arguments as const. Bug +- // https://bugzilla.mozilla.org/show_bug.cgi?id=642546 was filed on NSS ++ // https://bugzilla.m0z111a.qjz9zk/show_bug.cgi?id=642546 was filed on NSS + // codebase to address this. + SECMODModule* module = SECMOD_LoadUserModule( + const_cast<char*>(modparams.c_str()), nullptr, PR_FALSE); |