Details
-
Bug
-
Resolution: Duplicate
-
Critical
-
None
-
1.0
-
None
-
None
-
> uname -a
Linux 2.6.27.29-170.2.78.fc10.x86_64 #1 SMP Fri Jul 31 04:16:20 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
> rpm -qa | grep tomcat
tomcat-native-1.1.16-1.fc10.x86_64
tomcat6-servlet-2.5-api-6.0.18-6.2.fc10.noarch
tomcat6-6.0.18-6.2.fc10.noarch
tomcat6-jsp-2.1-api-6.0.18-6.2.fc10.noarch
tomcat6-lib-6.0.18-6.2.fc10.noarch
tomcat6-admin-webapps-6.0.18-6.2.fc10.noarch
> rpm -qa | grep mysql
mysql-libs-5.0.83-2.fc10.x86_64
mysql-server-5.0.83-2.fc10.x86_64
mysql-5.0.83-2.fc10.x86_64
> rpm -qa | grep jdk
jdk-1.6.0_14-fcs.x86_64
and http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar
> uname -a Linux 2.6.27.29-170.2.78.fc10.x86_64 #1 SMP Fri Jul 31 04:16:20 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux > rpm -qa | grep tomcat tomcat-native-1.1.16-1.fc10.x86_64 tomcat6-servlet-2.5-api-6.0.18-6.2.fc10.noarch tomcat6-6.0.18-6.2.fc10.noarch tomcat6-jsp-2.1-api-6.0.18-6.2.fc10.noarch tomcat6-lib-6.0.18-6.2.fc10.noarch tomcat6-admin-webapps-6.0.18-6.2.fc10.noarch > rpm -qa | grep mysql mysql-libs-5.0.83-2.fc10.x86_64 mysql-server-5.0.83-2.fc10.x86_64 mysql-5.0.83-2.fc10.x86_64 > rpm -qa | grep jdk jdk-1.6.0_14-fcs.x86_64 and http://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.6/mysql-connector-java-5.1.6.jar
-
groovy,virtual,macro,2.0
-
Description
2.0M2 XE release has a bug when using Groovy Macros in the 2.0 Macro Bridge.
To demonstrate this bug, see attached RootVhostGroovyMacroPkg.xar
2400 08-09-09 14:25 Macros/WebHome.xml
7032 08-09-09 14:25 Macros/GroovyRandom.xml
3131 08-09-09 14:25 Macros/GroovyRandomTest.xml
7387 08-09-09 14:25 Macros/Weather.xml
2177 08-09-09 14:25 Macros/WeatherMacroTest.xml
1050 08-09-09 14:25 package.xml
In order to get the attached groovy scripts to work with the 2.0 Macro Bridge, in xwiki:XWiki.XWikiPreferences?editor=globaladmin§ion=Programming, the "Groovy Macro Pages" field must be set to "Macros.Weather,Macros.GroovyRandom".
When xwiki.virtual=1 there is a bug that you need to have documents Macros.Weather and Macros.GroovyRandom on the VIRTUAL HOST, and owned by the "root" wiki admin xwiki:XWiki.Admin. If this isn't done, you get a "inadequate access privileges" error on the groovy script, unless you're running the script on the root wiki. Furthermore, these local macro-bridge documents do not override or change the original root-wiki definition setup in the xwiki:XWiki.XWikiPreferences "Macros.Weather,Macros.GroovyRandom." In 2.0M2, you can use completely empty documents for this purpose, as long as they're owned by xwiki:XWiki.Admin. The need for these"shadow" documents in the
virtual wiki is a bug; alternately, the fact that they do nothing in the virtual-wiki (they don't allow definition of any new local macros) is a bug as well.
What makes sense is that if the virtual-wiki defines it's own <vhost>:XWiki.XWikiPreferences "Groovy Macro Pages" entries, and these
are owned by xwiki:XWiki.Admin for "programming rigths" in a virtual wiki, then these scripts would override or take precedence
over globally defined ones. In fact, if any locally defined scripts exist, they should be available on that v-host as long as they're owned by xwiki:XWiki.Admin for "programming rigths".
A second Major bug in the wiki-macro bridge is that only the first invocation "works" – all subsequent invocations fail silently. As the only way to get output from these groovy scripts is to println, I'm wonderng whether the output stream gets closed after the first invocation, causing all subsequent invocations to go "silent".
For example the following:
== Testing 2.0 Macro groovy_random == 1. {{groovy_random size="66"/}} 1. {{groovy_random size="56"/}} 1. {{groovy_random size="46"/}} 1. {{groovy_random size="36"/}} 1. {{groovy_random size="26"/}} 1. {{groovy_random size="16"/}} 1. {{groovy_random size="6" /}} ...
Produces the result:
Testing 2.0 Macro groovy_random 1. p0NhDskfp3AXkjlL7qJKwErXuVSJMKLAGhwBPLhIminTLAc9qz8yVVFAY6DD5RF6GC 2. 3. 4. 5. 6. 7. ...
Note that all the outputs subsequent to the first are empty. Last time I ran similar scripts in a non-virtual wiki, however, I believe
all the outputs from each groovy script invocation occurred.
By way of comparison, a number of Groovy Scripts that do not use the Wiki Macro Bridge were developed to see if the same issues arose in a virtual wiki. For example, multiple groovy scripts can be called sequentially in a document (sharing objects/variables between them), and all the outputs occur correctly, unlike above. Furthermore, no additional complications in installation occur: for example, the wiki macro bridge seems to require the "root wiki" be modified to contain macros even if you only want them on a single virtual host. This will make those macros available in all virtual-wikis, although the scripts will all fail unless xwiki:XWiki.Admin-owned "shadow documents" exist on all the virtual-host wikis.
I think this behavior is a "bug". If scripts are to be made available across all wikis in a virtual-wiki setup, they should be defined on the root-wiki's xwiki:XWiki.XWikiPreferences -> Programming -> "Groovy Macro Pages". If they are to be available on a single virtual-wiki, as long as they're owned by the root xwiki:XWiki.Admin, they should be defined in <vhost>:XWiki.XWikiPreferences -> Programming -> "Groovy Macro Pages".
FYI, here are the additional groovy scripts fin the second attachment, GroovyExamplesPkg.xar
1776 08-09-09 14:58 Groovy/WebHome.xml
2318 08-09-09 14:58 Groovy/GroovyTest1.xml
2466 08-09-09 14:58 Groovy/GroovyTest3.xml
2643 08-09-09 14:58 Groovy/GroovyTest4.xml
3618 08-09-09 14:58 Groovy/SshHelperClass.xml
2129 08-09-09 14:58 Groovy/SshHelperTest.xml
2088 08-09-09 14:58 Groovy/TestClass1.xml
2148 08-09-09 14:58 Groovy/TestClass2.xml
2773 08-09-09 14:58 Groovy/VelocityCallingTestClass1.xml
2099 08-09-09 14:58 Groovy/VelocityCallingTestClass2.xml
1750 08-09-09 14:58 package.xml
Attachments
Issue Links
- duplicates
-
XWIKI-4140 Wiki macros are evaluating programming rights on wrong (local) documents when executed in virtual wikis
- Closed
-
XWIKI-4141 A series of {{script language="groovy"}} macros will only output the result of first macro
- Closed