Kaydet (Commit) 8246bdb5 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

fdo#55138: Do not double-expand bootstrap variables

For some reason that escapes me now, the old code double-expanded URLs in
CONFIGURATION_LAYERS and in extension layer's configmgr.ini SCHEMA/DATA.  That
produced wrong results when the pathnames represented by those URLs contain
any "$" characters, as apparently routinely happens on Windows with roaming
profiles.

Change-Id: Iff149e7d8736cbcda579376cdc89e24cf99ccc97
üst 4de42d02
...@@ -527,7 +527,7 @@ Components::Components( ...@@ -527,7 +527,7 @@ Components::Components(
n = conf.getLength(); n = conf.getLength();
} }
rtl::OUString type(conf.copy(i, c - i)); rtl::OUString type(conf.copy(i, c - i));
rtl::OUString url(expand(conf.copy(c + 1, n - c - 1))); rtl::OUString url(conf.copy(c + 1, n - c - 1));
if ( type == "xcsxcu" ) { if ( type == "xcsxcu" ) {
parseXcsXcuLayer(layer, url); parseXcsXcuLayer(layer, url);
layer += 2; //TODO: overflow layer += 2; //TODO: overflow
...@@ -684,12 +684,11 @@ void Components::parseFiles( ...@@ -684,12 +684,11 @@ void Components::parseFiles(
void Components::parseFileList( void Components::parseFileList(
int layer, FileParser * parseFile, rtl::OUString const & urls, int layer, FileParser * parseFile, rtl::OUString const & urls,
rtl::Bootstrap const & ini, bool recordAdditions) bool recordAdditions)
{ {
for (sal_Int32 i = 0;;) { for (sal_Int32 i = 0;;) {
rtl::OUString url(urls.getToken(0, ' ', i)); rtl::OUString url(urls.getToken(0, ' ', i));
if (!url.isEmpty()) { if (!url.isEmpty()) {
ini.expandMacrosFrom(url); //TODO: detect failure
Additions * adds = 0; Additions * adds = 0;
if (recordAdditions) { if (recordAdditions) {
adds = data_.addExtensionXcuAdditions(url, layer); adds = data_.addExtensionXcuAdditions(url, layer);
...@@ -819,9 +818,7 @@ void Components::parseXcsXcuIniLayer( ...@@ -819,9 +818,7 @@ void Components::parseXcsXcuIniLayer(
// Check if ini file exists (otherwise .override would still read global // Check if ini file exists (otherwise .override would still read global
// SCHEMA/DATA variables, which could interfere with unrelated environment // SCHEMA/DATA variables, which could interfere with unrelated environment
// variables): // variables):
rtl::Bootstrap ini(url); if (rtl::Bootstrap(url).getHandle() != 0) {
if (ini.getHandle() != 0)
{
rtl::OUStringBuffer prefix("${.override:"); rtl::OUStringBuffer prefix("${.override:");
for (sal_Int32 i = 0; i != url.getLength(); ++i) { for (sal_Int32 i = 0; i != url.getLength(); ++i) {
sal_Unicode c = url[i]; sal_Unicode c = url[i];
...@@ -840,13 +837,13 @@ void Components::parseXcsXcuIniLayer( ...@@ -840,13 +837,13 @@ void Components::parseXcsXcuIniLayer(
rtl::Bootstrap::expandMacros(urls); rtl::Bootstrap::expandMacros(urls);
if (!urls.isEmpty()) if (!urls.isEmpty())
{ {
parseFileList(layer, &parseXcsFile, urls, ini, false); parseFileList(layer, &parseXcsFile, urls, false);
} }
urls = prefix.makeStringAndClear() + rtl::OUString("DATA}"); urls = prefix.makeStringAndClear() + rtl::OUString("DATA}");
rtl::Bootstrap::expandMacros(urls); rtl::Bootstrap::expandMacros(urls);
if (!urls.isEmpty()) if (!urls.isEmpty())
{ {
parseFileList(layer + 1, &parseXcuFile, urls, ini, recordAdditions); parseFileList(layer + 1, &parseXcuFile, urls, recordAdditions);
} }
} }
} }
......
...@@ -43,10 +43,7 @@ namespace com { namespace sun { namespace star { ...@@ -43,10 +43,7 @@ namespace com { namespace sun { namespace star {
class XComponentContext; class XComponentContext;
} }
} } } } } }
namespace rtl { namespace rtl { class OUString; }
class Bootstrap;
class OUString;
}
namespace configmgr { namespace configmgr {
...@@ -132,7 +129,7 @@ private: ...@@ -132,7 +129,7 @@ private:
void parseFileList( void parseFileList(
int layer, FileParser * parseFile, rtl::OUString const & urls, int layer, FileParser * parseFile, rtl::OUString const & urls,
rtl::Bootstrap const & ini, bool recordAdditions); bool recordAdditions);
void parseXcdFiles(int layer, rtl::OUString const & url); void parseXcdFiles(int layer, rtl::OUString const & url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment