fdo#53006: And detect LO downgrading scenarios...
...that reinstall potentially broken prereg data but do not touch the buildid file. Change-Id: I1b02d2c265523dd751d8ef7f2dccb59ed048f568
This commit is contained in:
@@ -216,6 +216,18 @@ void removeTree(OUString const & url) {
|
|||||||
// detected here and lead to a removal of user/extensions/bundled, so that
|
// detected here and lead to a removal of user/extensions/bundled, so that
|
||||||
// Desktop::SynchronizeExtensionRepositories will then definitely resync
|
// Desktop::SynchronizeExtensionRepositories will then definitely resync
|
||||||
// share/extensions.)
|
// share/extensions.)
|
||||||
|
// As a special case, if you create a UserInstallation with LO >= 3.6.1, then
|
||||||
|
// run an old LO <= 3.5.x using share/prereg/bundled on the same
|
||||||
|
// UserInstallation (so that it partially overwrites user/extensions/bundled,
|
||||||
|
// potentially duplicating component information, but not touching
|
||||||
|
// user/extensions/bundled/buildid), and then run the new LO >= 3.6.1 on the
|
||||||
|
// same UserInstallation again, it can fail to start (due to the duplicated
|
||||||
|
// component information). Even though such downgrading scenarios at best work
|
||||||
|
// by luck in general, the special token LIBO_NON_PREREG_BUNDLED_EXTENSIONS=TRUE
|
||||||
|
// is used to detect and fix that problem: The assumption is that if an old LO
|
||||||
|
// <= 3.5.x messed with user/extensions/bundled in the meantime, then it would
|
||||||
|
// have rewritten the unorc (dropping the token), and LO >= 3.6.1 can detect
|
||||||
|
// that.
|
||||||
void refreshBundledExtensionsDir() {
|
void refreshBundledExtensionsDir() {
|
||||||
OUString buildId(
|
OUString buildId(
|
||||||
"${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}");
|
"${$BRAND_BASE_DIR/program/" SAL_CONFIGFILE("version") ":buildid}");
|
||||||
@@ -223,6 +235,12 @@ void refreshBundledExtensionsDir() {
|
|||||||
OUString dir("$BUNDLED_EXTENSIONS_USER");
|
OUString dir("$BUNDLED_EXTENSIONS_USER");
|
||||||
rtl::Bootstrap::expandMacros(dir); //TODO: detect failure
|
rtl::Bootstrap::expandMacros(dir); //TODO: detect failure
|
||||||
OUString url(dir + "/buildid");
|
OUString url(dir + "/buildid");
|
||||||
|
OUString nonPrereg(
|
||||||
|
"${$BUNDLED_EXTENSIONS_USER/registry/"
|
||||||
|
"com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc:"
|
||||||
|
"LIBO_NON_PREREG_BUNDLED_EXTENSIONS}");
|
||||||
|
rtl::Bootstrap::expandMacros(nonPrereg);
|
||||||
|
if (nonPrereg == "TRUE") {
|
||||||
osl::File f(url);
|
osl::File f(url);
|
||||||
switch (f.open(osl_File_OpenFlag_Read)) {
|
switch (f.open(osl_File_OpenFlag_Read)) {
|
||||||
case osl::FileBase::E_None:
|
case osl::FileBase::E_None:
|
||||||
@@ -230,7 +248,8 @@ void refreshBundledExtensionsDir() {
|
|||||||
rtl::ByteSequence s1;
|
rtl::ByteSequence s1;
|
||||||
osl::FileBase::RC rc = f.readLine(s1);
|
osl::FileBase::RC rc = f.readLine(s1);
|
||||||
if (f.close() != osl::FileBase::E_None) {
|
if (f.close() != osl::FileBase::E_None) {
|
||||||
SAL_WARN("desktop", "cannot close " + url + " after reading");
|
SAL_WARN(
|
||||||
|
"desktop", "cannot close " + url + " after reading");
|
||||||
}
|
}
|
||||||
if (rc != osl::FileBase::E_None) {
|
if (rc != osl::FileBase::E_None) {
|
||||||
throw css::uno::RuntimeException(
|
throw css::uno::RuntimeException(
|
||||||
@@ -240,8 +259,8 @@ void refreshBundledExtensionsDir() {
|
|||||||
OUString s2(
|
OUString s2(
|
||||||
reinterpret_cast< char const * >(s1.getConstArray()),
|
reinterpret_cast< char const * >(s1.getConstArray()),
|
||||||
s1.getLength(), RTL_TEXTENCODING_ISO_8859_1);
|
s1.getLength(), RTL_TEXTENCODING_ISO_8859_1);
|
||||||
// using ISO 8859-1 avoids any and all conversion errors; the
|
// using ISO 8859-1 avoids any and all conversion errors;
|
||||||
// content should only be a subset of ASCII, anyway
|
// the content should only be a subset of ASCII, anyway
|
||||||
if (s2 == buildId) {
|
if (s2 == buildId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -254,6 +273,7 @@ void refreshBundledExtensionsDir() {
|
|||||||
"cannot open " + url + " for reading",
|
"cannot open " + url + " for reading",
|
||||||
css::uno::Reference< css::uno::XInterface >());
|
css::uno::Reference< css::uno::XInterface >());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
removeTree(dir);
|
removeTree(dir);
|
||||||
switch (osl::Directory::createPath(dir)) {
|
switch (osl::Directory::createPath(dir)) {
|
||||||
case osl::FileBase::E_None:
|
case osl::FileBase::E_None:
|
||||||
@@ -264,6 +284,7 @@ void refreshBundledExtensionsDir() {
|
|||||||
"cannot create path " + dir,
|
"cannot create path " + dir,
|
||||||
css::uno::Reference< css::uno::XInterface >());
|
css::uno::Reference< css::uno::XInterface >());
|
||||||
}
|
}
|
||||||
|
osl::File f(url);
|
||||||
if (f.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create) !=
|
if (f.open(osl_File_OpenFlag_Write | osl_File_OpenFlag_Create) !=
|
||||||
osl::FileBase::E_None)
|
osl::FileBase::E_None)
|
||||||
{
|
{
|
||||||
|
@@ -1021,6 +1021,13 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv )
|
|||||||
buf.append(LF);
|
buf.append(LF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// See refreshBundledExtensionsDir (desktop/source/app/app.cxx):
|
||||||
|
if (m_eContext == CONTEXT_BUNDLED)
|
||||||
|
{
|
||||||
|
buf.append("LIBO_NON_PREREG_BUNDLED_EXTENSIONS=TRUE");
|
||||||
|
buf.append(LF);
|
||||||
|
}
|
||||||
|
|
||||||
// write unorc:
|
// write unorc:
|
||||||
const Reference<io::XInputStream> xData(
|
const Reference<io::XInputStream> xData(
|
||||||
::xmlscript::createInputStream(
|
::xmlscript::createInputStream(
|
||||||
|
Reference in New Issue
Block a user