From f04cb4f73121710503884e24aeed27178601888a Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 9 Dec 2013 09:38:35 +0100 Subject: fdo#72394 Don't endlessly expand $(share_subdir_name) into itself The introduction of $(share_subdir_name) expanding to "share" in c6a73009747814513ab5a7277c211449c7378870 "Use subfolder names from " shows that SubstitutePathVariables::impl_reSubstituteVariables is fundamentally flawed in that it allows reducing variable occurrences even in variable names, so that it will expand an occurrence of "share" into an endless recursion of "$(share_subdir_name)" -> "$($(share_subdir_name)_subdir_name)" -> ... Adding $(share_subdir_name) to the list of variables that can only replace a complete path segment (delimited by "/"), from which it had erroneously been missing, "fixes" this problem for now. But the code is still wrong in at least two respects: * SubstitutePathVariables::impl_reSubstituteVariables arguably needs to be made more robust, to never reduce variable occurrences in variable names. * The compile-time variable LIBO_SHARE_FOLDER should not end up as a runtime framework path variable, esp. since accidentally re-substituting it for "share" segments in unrelated URLs like does not make sense. ac4e19f9085dbd0103c7336a5318aa1e55b3e3e0 "fdo#68552: Don't (attempt to) do run-time expansion of build-time parameters" had already attempted a fix for that, but it had to be reverted again with 791a8b96f754798192875da287c84f8cfa4e533e because it "Unfortunately does not work if BUILDDIR is different from SRCDIR." Change-Id: If214c179c0068fbaa475c1c9cac804d6a1dbb2dc (cherry picked from commit 56211a166ab25d80de84c2cccce22be15a9be051) --- framework/source/services/substitutepathvars.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'framework') diff --git a/framework/source/services/substitutepathvars.cxx b/framework/source/services/substitutepathvars.cxx index 41c03242454e..ec781f2b8a06 100644 --- a/framework/source/services/substitutepathvars.cxx +++ b/framework/source/services/substitutepathvars.cxx @@ -999,7 +999,8 @@ throw ( RuntimeException ) bool bMatch = true; if ( pIterFixed->eVariable == PREDEFVAR_LANG || pIterFixed->eVariable == PREDEFVAR_LANGID || - pIterFixed->eVariable == PREDEFVAR_VLANG ) + pIterFixed->eVariable == PREDEFVAR_VLANG || + pIterFixed->eVariable == PREDEFVAR_SHARE_SUBDIR_NAME ) { // Special path variables as they can occur in the middle of a path. Only match if they // describe a whole directory and not only a substring of a directory! -- cgit