Repository navigation
Fix BZ 69902 - set file permissions in the ZIP distribution - #1091
Merged
Merged
Conversation
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.
Contributor
|
Tx. looks good to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
https://bz.apache.org/bugzilla/show_bug.cgi?id=69902
package-tgzsets an explicitdirmodeandfilemodeon each of itstarfilesets.package-zipsets none, so entries are stored with Ant's defaults, 0644 for files and0755 for directories, and
bin/*.shis not executable once the archive is extracted on aUnix platform.
dist-staticalready marks the scripts executable on disk, but azipfilesetwith nofilemodestores its own default rather than the mode on disk, sothe bit is dropped at packaging time. The reporter ran into this installing Tomcat
through sdkman (sdkman/sdkman-cli#974).
On the line endings in comment #1: they are already right for the scripts.
dist-staticsets
bin/*.shto LF, and*.shis not in thetext.filespatternset that thefixcrlfpass at the top ofpackage-zipuses, so the scripts stay LF while the textfiles stay CRLF. This change does not touch that; only the stored modes change.
The new filesets mirror the ones in
package-tgz:conf0700 with 0600 contents, thenbin,lib,logs,temp,webapps,workand the top-level text files 0750/0640,then
bin/*.sh0750 in a fileset of its own after the rest. The<exclude name="bin/*.sh"/>is needed because<zip>defaults toduplicate="add":without it each script is stored twice, first at 0640 and then at 0750.
package-tgzcarries the same exclude for the same reason.
Two things left as they are. The top-level
apache-tomcat-<version>/entry keeps Ant'sdefault 0755, because it comes from the
<zipfileset file="..." fullpath="..."/>linerather than from the filesets; the
.tar.gzhas no such entry, so extracting it createsthat directory from the umask, which is also 0755 with the usual 022.
package-winzipisunchanged, as the Windows artifact. The deployer, embedded and source archives set no
modes in either format, so
package-zipwas the only target where the ZIP and thetar.gz disagreed.
Testing, since comment #1 asked for it. I ran the old and the new
package-zipfilesetsand the
package-tgzones with Ant 1.10.15 over a stand-in${tomcat.dist}tree ratherthan a full
ant release. The new ZIP stores the same permissions as the.tar.gzforevery entry the two have in common:
Extracted with
unzipunder umask 022,bin/catalina.shis 0644 before the change andrunning it fails with "permission denied"; after the change it is 0750 and runs. The
entries were already written with
create_system3 (UNIX) before the change, so thischanges the mode values rather than whether modes are stored at all, and no entry gets
the DOS read-only attribute.