https://bugs.documentfoundation.org/show_bug.cgi?id=102630
Bug ID: 102630
Summary: Useless /org.openoffice.Office/Substitution feature
Product: LibreOffice
Version: Inherited From OOo
Hardware: All
OS: All
Status: UNCONFIRMED
Severity: normal
Priority: medium
Component: framework
Assignee: [email protected]
Reporter: [email protected]
There is an /org.openoffice.Office/Substitution configuration tree (defined in
officecfg/registry/schema/org/openoffice/Office/Substitution.xcs) offering a
"SharePoints" set of variable replacements, and the implementation of the
com.sun.star.util.PathSubstitution UNO service (in
framework/source/services/substitutepathvars.cxx) is designed to support those
"SharePoints" variable replacements (though in a broken way).
However:
For one, there is no sign in the git logs that that "SharePoints" configuration
set was ever non-empty, in neither LO nor OOo times.
For another, the PathSubstitution UNO service intends to support those
"SharePoints" variable replacements both when resolving strings containing such
variable names (substituteVariables, getSubstituteVariableValue) and when
introducing variable names into strings (reSubstituteVariables). However, the
latter is implemented (ever since
<https://cgit.freedesktop.org/libreoffice/core/commit/?id=a56ebe278ae13de0a2baa821e30c16b4f06a4191>
"#100825# New services for path settings and path substitution", in
SubstitutePathVariables::impl_reSubstituteVariables,
framework/source/services/substitutepathvars.cxx) in such a way that it tries
to introduce "$(var-name)" as a replacement for "$(var-name)" (i.e., as a
replacement for the variable's name, instead of the variable's content), so
will never introduce such a variable name into a string. And when such a
variable name is never introduced into a string via reSubstituteVariables, it's
unlikely that it will ever appear in a string passed to substituteVariables or
getSubstituteVariableValue (given that the normal use of this UNO service is to
introduce variable names when saving a document, and then converting back when
loading the document).
In short, this feature looks both unused and broken "since forever". (It may
have been used in some way in StarOffice-only code.) Theoretically, an
extension or external application could populate that "SharePoints"
configuration set and cause strings passed to the UNO services
substituteVariables or getSubstituteVariableValue methods to contain matching
variable names, but that's probably unlikely.
(For completeness, a way to try this out is to place a
share/registry/data/Substitution.xcu file into a LO installation with content
> <?xml version="1.0" encoding="UTF-8"?>
> <oor:component-data oor:name="Substitution"
> oor:package="org.openoffice.Office"
> xmlns:oor="http://openoffice.org/2001/registry">
> <node oor:name="SharePoints">
> <node oor:name="test" oor:op="fuse">
> <node oor:name="item" oor:op="replace">
> <prop oor:name="Directory"><value>file:///dummy</value></prop>
> <node oor:name="Environment">
> <prop oor:name="Host"><value>*</value></prop>
> </node>
> </node>
> </node>
> </node>
> </oor:component-data>
If you replace oor:name="test" with oor:name="inst" and try to save an Impress
document, it will cause an endless loop in
SubstitutePathVariables::impl_reSubstituteVariables
(framework/source/services/substitutepathvars.cxx), as it will keep replacing
"$(inst)" with "$(inst)" in the (already partly re-substituted) URL
<$(inst)/share/palette%3B$(user)/config/standard.sob>.)
--
You are receiving this mail because:
You are the assignee for the bug._______________________________________________
Libreoffice-bugs mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs