You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2022/01/26 15:42:44 UTC
[tomcat] 03/07: Refactor to avoid reproducibility issues due to zip task ordering
This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git
commit bb1c10107f7013d17ba217800b9faba19bfaffb4
Author: Mark Thomas <ma...@apache.org>
AuthorDate: Thu Jan 20 20:00:58 2022 +0000
Refactor to avoid reproducibility issues due to zip task ordering
Ant's zip task orders the entires based OS file names. '/' and '\' have
very different ordering so reafctor to directory names that are not
affected by this so zip files are consistent across Linux and Windows.
---
.../apache/catalina/core/TestStandardWrapper.java | 4 +--
.../apache/catalina/loader/TestVirtualContext.java | 28 ++++++++++-----------
.../WEB-INF/web.xml | 0
.../WEB-INF/web.xml | 0
.../protected.jsp | 0
.../unprotected.jsp | 0
.../src/main/{webapp => webapp-a}/WEB-INF/A.tld | 0
.../WEB-INF/classes/rsrc/resourceA.properties | 0
.../main/{webapp => webapp-a}/WEB-INF/lib/rsrc.jar | Bin
.../src/main/{webapp => webapp-a}/WEB-INF/web.xml | 0
.../classpathGetResourceAsStream.jsp | 0
.../classpathGetResourceUrlThenGetStream.jsp | 0
.../{webapp => webapp-a}/classpathGetResources.jsp | 0
.../{webapp => webapp-a}/contextGetRealPath.jsp | 0
.../{webapp => webapp-a}/contextGetResource.jsp | 0
.../contextGetResourcePaths.jsp | 0
.../{webapp => webapp-a}/rsrc/resourceF.properties | 0
.../src/main/{webapp => webapp-a}/testTlds.jsp | 0
.../src/main/{webapp2 => webapp-b}/WEB-INF/D.tld | 0
.../WEB-INF/classes/rsrc-2}/resourceK.properties | 0
.../WEB-INF/classes/rsrc/resourceG.properties | 0
.../rsrc2 => webapp-b/rsrc-2}/resourceJ.properties | 0
.../rsrc/resourceF.properties | 2 +-
.../rsrc/resourceH.properties | 0
webapps/docs/changelog.xml | 5 ++++
.../WEB-INF/{jsp2 => jsp}/jsp2-example-taglib.tld | 0
webapps/examples/WEB-INF/web.xml | 2 +-
webapps/examples/jsp/jsp2/simpletag/book.jsp | 2 +-
webapps/examples/jsp/jsp2/simpletag/hello.jsp | 2 +-
webapps/examples/jsp/jsp2/simpletag/repeat.jsp | 2 +-
30 files changed, 26 insertions(+), 21 deletions(-)
diff --git a/test/org/apache/catalina/core/TestStandardWrapper.java b/test/org/apache/catalina/core/TestStandardWrapper.java
index 4018134..89f11fd 100644
--- a/test/org/apache/catalina/core/TestStandardWrapper.java
+++ b/test/org/apache/catalina/core/TestStandardWrapper.java
@@ -191,7 +191,7 @@ public class TestStandardWrapper extends TomcatBaseTest {
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
- File appDir = new File("test/webapp-servletsecurity");
+ File appDir = new File("test/webapp-servletsecurity-a");
tomcat.addWebapp(null, "", appDir.getAbsolutePath());
tomcat.start();
@@ -210,7 +210,7 @@ public class TestStandardWrapper extends TomcatBaseTest {
// Setup Tomcat instance
Tomcat tomcat = getTomcatInstance();
- File appDir = new File("test/webapp-servletsecurity2");
+ File appDir = new File("test/webapp-servletsecurity-b");
tomcat.addWebapp(null, "", appDir.getAbsolutePath());
tomcat.start();
diff --git a/test/org/apache/catalina/loader/TestVirtualContext.java b/test/org/apache/catalina/loader/TestVirtualContext.java
index c8d8845..4302af7 100644
--- a/test/org/apache/catalina/loader/TestVirtualContext.java
+++ b/test/org/apache/catalina/loader/TestVirtualContext.java
@@ -58,7 +58,7 @@ public class TestVirtualContext extends TomcatBaseTest {
Tomcat tomcat = getTomcatInstance();
- File appDir = new File("test/webapp-virtual-webapp/src/main/webapp");
+ File appDir = new File("test/webapp-virtual-webapp/src/main/webapp-a");
// app dir is relative to server home
StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
appDir.getAbsolutePath());
@@ -67,11 +67,11 @@ public class TestVirtualContext extends TomcatBaseTest {
File f1 = new File("test/webapp-virtual-webapp/target/classes");
File f2 = new File("test/webapp-virtual-library/target/WEB-INF");
File f3 = new File(
- "test/webapp-virtual-webapp/src/main/webapp/WEB-INF/classes");
+ "test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/classes");
File f4 = new File(
- "test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes");
+ "test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes");
File f5 = new File("test/webapp-virtual-webapp/src/main/misc");
- File f6 = new File("test/webapp-virtual-webapp/src/main/webapp2");
+ File f6 = new File("test/webapp-virtual-webapp/src/main/webapp-b");
ctx.getResources().createWebResourceSet(
WebResourceRoot.ResourceSetType.POST, "/WEB-INF/classes",
f1.getAbsolutePath(), null, "/");
@@ -143,13 +143,13 @@ public class TestVirtualContext extends TomcatBaseTest {
"/test/classpathGetResources.jsp?path=rsrc/").toString();
Assert.assertTrue(
allUrls,
- allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc") > 0);
+ allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/classes/rsrc") > 0);
Assert.assertTrue(
allUrls,
- allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc") > 0);
+ allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes/rsrc") > 0);
Assert.assertTrue(
allUrls,
- allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar!/rsrc") > 0);
+ allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/lib/rsrc.jar!/rsrc") > 0);
Assert.assertTrue(
allUrls,
allUrls.indexOf("/test/webapp-virtual-webapp/target/classes/rsrc") > 0);
@@ -165,10 +165,10 @@ public class TestVirtualContext extends TomcatBaseTest {
String allRsrsc2ClasspathUrls =
getUrl(
"http://localhost:" + getPort() +
- "/test/classpathGetResources.jsp?path=rsrc2/").toString();
+ "/test/classpathGetResources.jsp?path=rsrc-2/").toString();
Assert.assertTrue(
allRsrsc2ClasspathUrls,
- allRsrsc2ClasspathUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2") > 0);
+ allRsrsc2ClasspathUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes/rsrc-2") > 0);
// tests context.getRealPath
@@ -180,7 +180,7 @@ public class TestVirtualContext extends TomcatBaseTest {
// Real paths depend on the OS and this test has to work on all
// platforms so use File to convert the path to a platform specific form
File f = new File(
- "test/webapp-virtual-webapp/src/main/webapp/rsrc/resourceF.properties");
+ "test/webapp-virtual-webapp/src/main/webapp-a/rsrc/resourceF.properties");
assertPageContains(
"/test/contextGetRealPath.jsp?path=/rsrc/resourceF.properties",
f.getPath());
@@ -202,7 +202,7 @@ public class TestVirtualContext extends TomcatBaseTest {
"/test/contextGetResource.jsp?path=/other/resourceI.properties",
"resourceIInWebapp=true");
assertPageContains(
- "/test/contextGetResource.jsp?path=/rsrc2/resourceJ.properties",
+ "/test/contextGetResource.jsp?path=/rsrc-2/resourceJ.properties",
"resourceJInWebapp=true");
String allRsrcPaths =
@@ -227,10 +227,10 @@ public class TestVirtualContext extends TomcatBaseTest {
String allRsrc2Paths =
getUrl(
"http://localhost:" + getPort() +
- "/test/contextGetResourcePaths.jsp?path=/rsrc2/").toString();
+ "/test/contextGetResourcePaths.jsp?path=/rsrc-2/").toString();
Assert.assertTrue(
allRsrc2Paths,
- allRsrc2Paths.indexOf("/rsrc2/resourceJ.properties") > 0);
+ allRsrc2Paths.indexOf("/rsrc-2/resourceJ.properties") > 0);
assertPageContains(
"/test/testTlds.jsp",
@@ -250,7 +250,7 @@ public class TestVirtualContext extends TomcatBaseTest {
public void testAdditionalWebInfClassesPaths() throws Exception {
Tomcat tomcat = getTomcatInstance();
- File appDir = new File("test/webapp-virtual-webapp/src/main/webapp");
+ File appDir = new File("test/webapp-virtual-webapp/src/main/webapp-a");
// app dir is relative to server home
StandardContext ctx = (StandardContext) tomcat.addWebapp(null, "/test",
appDir.getAbsolutePath());
diff --git a/test/webapp-servletsecurity/WEB-INF/web.xml b/test/webapp-servletsecurity-a/WEB-INF/web.xml
similarity index 100%
rename from test/webapp-servletsecurity/WEB-INF/web.xml
rename to test/webapp-servletsecurity-a/WEB-INF/web.xml
diff --git a/test/webapp-servletsecurity2/WEB-INF/web.xml b/test/webapp-servletsecurity-b/WEB-INF/web.xml
similarity index 100%
rename from test/webapp-servletsecurity2/WEB-INF/web.xml
rename to test/webapp-servletsecurity-b/WEB-INF/web.xml
diff --git a/test/webapp-servletsecurity2/protected.jsp b/test/webapp-servletsecurity-b/protected.jsp
similarity index 100%
rename from test/webapp-servletsecurity2/protected.jsp
rename to test/webapp-servletsecurity-b/protected.jsp
diff --git a/test/webapp-servletsecurity2/unprotected.jsp b/test/webapp-servletsecurity-b/unprotected.jsp
similarity index 100%
rename from test/webapp-servletsecurity2/unprotected.jsp
rename to test/webapp-servletsecurity-b/unprotected.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/A.tld b/test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/A.tld
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/WEB-INF/A.tld
rename to test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/A.tld
diff --git a/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties b/test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/classes/rsrc/resourceA.properties
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc/resourceA.properties
rename to test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/classes/rsrc/resourceA.properties
diff --git a/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar b/test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/lib/rsrc.jar
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar
rename to test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/lib/rsrc.jar
diff --git a/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/web.xml b/test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/web.xml
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/WEB-INF/web.xml
rename to test/webapp-virtual-webapp/src/main/webapp-a/WEB-INF/web.xml
diff --git a/test/webapp-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/classpathGetResourceAsStream.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/classpathGetResourceAsStream.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/classpathGetResourceAsStream.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/classpathGetResourceUrlThenGetStream.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/classpathGetResourceUrlThenGetStream.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/classpathGetResourceUrlThenGetStream.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/classpathGetResources.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/classpathGetResources.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/classpathGetResources.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/classpathGetResources.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/contextGetRealPath.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/contextGetRealPath.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/contextGetRealPath.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/contextGetRealPath.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/contextGetResource.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/contextGetResource.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/contextGetResource.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/contextGetResource.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/contextGetResourcePaths.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/contextGetResourcePaths.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/contextGetResourcePaths.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp/rsrc/resourceF.properties b/test/webapp-virtual-webapp/src/main/webapp-a/rsrc/resourceF.properties
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/rsrc/resourceF.properties
rename to test/webapp-virtual-webapp/src/main/webapp-a/rsrc/resourceF.properties
diff --git a/test/webapp-virtual-webapp/src/main/webapp/testTlds.jsp b/test/webapp-virtual-webapp/src/main/webapp-a/testTlds.jsp
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp/testTlds.jsp
rename to test/webapp-virtual-webapp/src/main/webapp-a/testTlds.jsp
diff --git a/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/D.tld b/test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/D.tld
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/D.tld
rename to test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/D.tld
diff --git a/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties b/test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes/rsrc-2/resourceK.properties
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2/resourceK.properties
rename to test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes/rsrc-2/resourceK.properties
diff --git a/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties b/test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes/rsrc/resourceG.properties
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc/resourceG.properties
rename to test/webapp-virtual-webapp/src/main/webapp-b/WEB-INF/classes/rsrc/resourceG.properties
diff --git a/test/webapp-virtual-webapp/src/main/webapp2/rsrc2/resourceJ.properties b/test/webapp-virtual-webapp/src/main/webapp-b/rsrc-2/resourceJ.properties
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp2/rsrc2/resourceJ.properties
rename to test/webapp-virtual-webapp/src/main/webapp-b/rsrc-2/resourceJ.properties
diff --git a/test/webapp-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties b/test/webapp-virtual-webapp/src/main/webapp-b/rsrc/resourceF.properties
similarity index 92%
rename from test/webapp-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties
rename to test/webapp-virtual-webapp/src/main/webapp-b/rsrc/resourceF.properties
index 9e4fa83..8484819 100644
--- a/test/webapp-virtual-webapp/src/main/webapp2/rsrc/resourceF.properties
+++ b/test/webapp-virtual-webapp/src/main/webapp-b/rsrc/resourceF.properties
@@ -14,4 +14,4 @@
# limitations under the License.
This file should not be served, it is masked by
-/test/webapp-virtual-webapp/src/main/webapp/rsrc/resourceF.properties
\ No newline at end of file
+/test/webapp-virtual-webapp/src/main/webapp-a/rsrc/resourceF.properties
\ No newline at end of file
diff --git a/test/webapp-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties b/test/webapp-virtual-webapp/src/main/webapp-b/rsrc/resourceH.properties
similarity index 100%
rename from test/webapp-virtual-webapp/src/main/webapp2/rsrc/resourceH.properties
rename to test/webapp-virtual-webapp/src/main/webapp-b/rsrc/resourceH.properties
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index e988f47..2a1b57e 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -120,6 +120,11 @@
Remove the applet example from the example web application as applets
are no longer supported in any major browser. (markt)
</fix>
+ <scode>
+ Refactor a small number of pages in the examples web application to
+ avoid an issue with reproducible builds due to differences in file
+ ordering across different operating systems with Ant's zip task. (markt)
+ </scode>
</changelog>
</subsection>
</section>
diff --git a/webapps/examples/WEB-INF/jsp2/jsp2-example-taglib.tld b/webapps/examples/WEB-INF/jsp/jsp2-example-taglib.tld
similarity index 100%
rename from webapps/examples/WEB-INF/jsp2/jsp2-example-taglib.tld
rename to webapps/examples/WEB-INF/jsp/jsp2-example-taglib.tld
diff --git a/webapps/examples/WEB-INF/web.xml b/webapps/examples/WEB-INF/web.xml
index 846459a..d45ee49 100644
--- a/webapps/examples/WEB-INF/web.xml
+++ b/webapps/examples/WEB-INF/web.xml
@@ -211,7 +211,7 @@
http://tomcat.apache.org/jsp2-example-taglib
</taglib-uri>
<taglib-location>
- /WEB-INF/jsp2/jsp2-example-taglib.tld
+ /WEB-INF/jsp/jsp2-example-taglib.tld
</taglib-location>
</taglib>
diff --git a/webapps/examples/jsp/jsp2/simpletag/book.jsp b/webapps/examples/jsp/jsp2/simpletag/book.jsp
index ba07cfb..4cce650 100644
--- a/webapps/examples/jsp/jsp2/simpletag/book.jsp
+++ b/webapps/examples/jsp/jsp2/simpletag/book.jsp
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
--%>
-<%@ taglib prefix="my" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+<%@ taglib prefix="my" uri="/WEB-INF/jsp/jsp2-example-taglib.tld" %>
<html>
<head>
<title>JSP 2.0 Examples - Book SimpleTag Handler</title>
diff --git a/webapps/examples/jsp/jsp2/simpletag/hello.jsp b/webapps/examples/jsp/jsp2/simpletag/hello.jsp
index d9f22a2..408c216 100644
--- a/webapps/examples/jsp/jsp2/simpletag/hello.jsp
+++ b/webapps/examples/jsp/jsp2/simpletag/hello.jsp
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
--%>
-<%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+<%@ taglib prefix="mytag" uri="/WEB-INF/jsp/jsp2-example-taglib.tld" %>
<html>
<head>
<title>JSP 2.0 Examples - Hello World SimpleTag Handler</title>
diff --git a/webapps/examples/jsp/jsp2/simpletag/repeat.jsp b/webapps/examples/jsp/jsp2/simpletag/repeat.jsp
index b12d0a9..234360f 100644
--- a/webapps/examples/jsp/jsp2/simpletag/repeat.jsp
+++ b/webapps/examples/jsp/jsp2/simpletag/repeat.jsp
@@ -14,7 +14,7 @@
See the License for the specific language governing permissions and
limitations under the License.
--%>
-<%@ taglib prefix="mytag" uri="/WEB-INF/jsp2/jsp2-example-taglib.tld" %>
+<%@ taglib prefix="mytag" uri="/WEB-INF/jsp/jsp2-example-taglib.tld" %>
<html>
<head>
<title>JSP 2.0 Examples - Repeat SimpleTag Handler</title>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org