Skip to content

Commit 0ab6097

Browse files
lioturmarkt-asf
authored andcommitted
Fix BZ 69902 - set file permissions in the ZIP distribution
package-tgz sets explicit dirmode and filemode values on its tarfilesets but package-zip does not, so entries are stored with Ant's defaults, 0644 for files and 0755 for directories, and the scripts in bin are not executable once the archive is extracted on a Unix platform. dist-static already marks them executable on disk; the mode is dropped at packaging time. Use the same modes as package-tgz: conf 0700 with 0600 contents, bin, lib, logs, temp, webapps and work 0750 with 0640 contents, the same for the top level text files, and the scripts in bin 0750. The bin/*.sh exclude keeps the scripts from being stored twice.
1 parent 07f725b commit 0ab6097

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

‎build.xml‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3238,9 +3238,11 @@ Configured for ${release.asfusername} to release Tomcat ${version.major}.${versi
32383238
modificationtime="${tstamp.iso.release}"
32393239
encoding="UTF8">
32403240
<zipfileset file="${tomcat.dist}" fullpath="${final.name}"/>
3241-
<zipfileset dir="${tomcat.dist}" prefix="${final.name}">
3242-
<include name="bin/**"/>
3241+
<zipfileset dir="${tomcat.dist}" dirmode="700" filemode="600" prefix="${final.name}">
32433242
<include name="conf/**"/>
3243+
</zipfileset>
3244+
<zipfileset dir="${tomcat.dist}" dirmode="750" filemode="640" prefix="${final.name}">
3245+
<include name="bin/**"/>
32443246
<include name="logs/**"/>
32453247
<include name="lib/**"/>
32463248
<include name="webapps/**"/>
@@ -3254,9 +3256,15 @@ Configured for ${release.asfusername} to release Tomcat ${version.major}.${versi
32543256
<include name="BUILDING.txt" />
32553257
<include name="CONTRIBUTING.md"/>
32563258
<exclude name="bin/service.bat"/>
3259+
<exclude name="bin/*.sh"/>
32573260
<exclude name="bin/*.exe"/>
32583261
<exclude name="bin/*.dll"/>
32593262
</zipfileset>
3263+
<!-- These need to be added after the bin directory is added else the -->
3264+
<!-- bin directory will pick up the wrong permissions. -->
3265+
<zipfileset dir="${tomcat.dist}" dirmode="750" filemode="750" prefix="${final.name}">
3266+
<include name="bin/*.sh"/>
3267+
</zipfileset>
32603268
</zip>
32613269

32623270
<hashAndSign file="${tomcat.release}/v${version}/bin/${final.name}.zip" />

‎webapps/docs/changelog.xml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -863,6 +863,12 @@
863863
(<code>output/coverage/jacoco.xml</code>) alongside the existing HTML
864864
report when the build is run with code coverage enabled. (dsoumis)
865865
</add>
866+
<update>
867+
<bug>69902</bug>: Change the ZIP distribution to store the same file
868+
and directory permissions as the tar.gz distribution so that the
869+
scripts in <code>bin</code> are executable when the archive is
870+
extracted on a Unix platform.
871+
</update>
866872
<!-- Entries for backport and removal before 12.0.0-M1 below this line -->
867873
</changelog>
868874
</subsection>

0 commit comments

Comments
 (0)