diff options
author | Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> | 2020-01-20 11:12:12 +0100 |
---|---|---|
committer | Thorsten Behrens <thorsten.behrens@allotropia.de> | 2021-04-09 23:22:06 +0200 |
commit | a838b15d7d01f1967291063bdf948b5deed00fd5 (patch) | |
tree | ae00b222a9bc6094cffa0b36e79ec32dac6de83a | |
parent | 56df72bcc6367945bc379ebabb226035c78482db (diff) |
tdf#129917 Use temp user profile when installing shared extensions
Change-Id: I62dd163758e6348a62fc8a0b25150a62f282de90
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86543
Tested-by: Jenkins
Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
(cherry picked from commit c51a43bd70aa9fec0a051e51622a6a91f5aaa1a9)
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_app.cxx | 15 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 7 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_shared.h | 2 |
3 files changed, 16 insertions, 8 deletions
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 35d2bee6f5c5..6064d1976aa1 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -31,6 +31,7 @@ #include <osl/process.h> #include <osl/conditn.hxx> #include <osl/file.hxx> +#include <unotools/tempfile.hxx> #include <cppuhelper/implbase.hxx> #include <cppuhelper/exc_hlp.hxx> #include <comphelper/anytostring.hxx> @@ -204,6 +205,7 @@ extern "C" int unopkg_main() Reference<XLogHandler> xFileHandler; Reference<XLogHandler> xConsoleHandler; std::unique_ptr<comphelper::EventLogger> logger; + std::unique_ptr<utl::TempFile> pUserProfileTempDir; OptionInfo const * info_shared = getOptionInfo( s_option_infos, "shared" ); @@ -298,8 +300,16 @@ extern "C" int unopkg_main() } } - xComponentContext = getUNO( - option_verbose, option_shared, subcmd_gui, xLocalComponentContext ); + // tdf#129917 Use temp user profile when installing shared extensions + if (option_shared) + { + pUserProfileTempDir.reset(new utl::TempFile(nullptr, true)); + pUserProfileTempDir->EnableKillingFile(); + } + + xComponentContext = getUNO(option_verbose, subcmd_gui, + pUserProfileTempDir ? pUserProfileTempDir->GetURL() : "", + xLocalComponentContext); // Initialize logging. This will log errors to the console and // also to file if the --log-file parameter was provided. @@ -359,7 +369,6 @@ extern "C" int unopkg_main() APP_NAME, toString(info_shared), toString(info_bundled)); return 1; } - } #endif diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 6a11fdeae059..dcf77eb71602 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -416,13 +416,12 @@ static OUString getLockFilePath() } Reference<XComponentContext> getUNO( - bool verbose, bool shared, bool bGui, + bool verbose, bool bGui, const OUString& sTempDir, Reference<XComponentContext> & out_localContext) { // do not create any user data (for the root user) in --shared mode: - if (shared) { - rtl::Bootstrap::set("CFG_CacheUrl", OUString()); - } + if (!sTempDir.isEmpty()) + rtl::Bootstrap::set("UserInstallation", sTempDir); // hold lock during process runtime: static ::desktop::Lockfile s_lockfile( false /* no IPC server */ ); diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 6d23b4c8f39e..68a46227314e 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -109,7 +109,7 @@ void printf_packages( css::uno::Reference<css::uno::XComponentContext> getUNO( - bool verbose, bool shared, bool bGui, + bool verbose, bool bGui, const OUString& sTempDir, css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext); } |