[Libreoffice-commits] core.git: desktop/source

Samuel Mehrbrodt (via logerrit) logerrit at kemper.freedesktop.org
Mon Feb 3 09:16:50 UTC 2020


 desktop/source/pkgchk/unopkg/unopkg_app.cxx  |   15 ++++++++++++---
 desktop/source/pkgchk/unopkg/unopkg_misc.cxx |    7 +++----
 desktop/source/pkgchk/unopkg/unopkg_shared.h |    2 +-
 3 files changed, 16 insertions(+), 8 deletions(-)

New commits:
commit c51a43bd70aa9fec0a051e51622a6a91f5aaa1a9
Author:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
AuthorDate: Mon Jan 20 11:12:12 2020 +0100
Commit:     Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
CommitDate: Mon Feb 3 10:16:14 2020 +0100

    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 at cib.de>

diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index 97abd4c9dbc0..8532366885c0 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -26,6 +26,7 @@
 #include <rtl/bootstrap.hxx>
 #include <osl/process.h>
 #include <osl/conditn.hxx>
+#include <unotools/tempfile.hxx>
 #include <cppuhelper/implbase.hxx>
 #include <cppuhelper/exc_hlp.hxx>
 #include <comphelper/anytostring.hxx>
@@ -196,6 +197,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" );
@@ -290,8 +292,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.
@@ -351,7 +361,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 50b6c58d9190..df276342b765 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -407,13 +407,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 04062a107e80..f86b3248c0d5 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -107,7 +107,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);
 
 }


More information about the Libreoffice-commits mailing list