liotur opened a new pull request, #1091:
URL: https://github.com/apache/tomcat/pull/1091

   https://bz.apache.org/bugzilla/show_bug.cgi?id=69902
   
   `package-tgz` sets an explicit `dirmode` and `filemode` on each of its 
`tarfileset`s.
   `package-zip` sets none, so entries are stored with Ant's defaults, 0644 for 
files and
   0755 for directories, and `bin/*.sh` is not executable once the archive is 
extracted on a
   Unix platform. `dist-static` already marks the scripts executable on disk, 
but a
   `zipfileset` with no `filemode` stores its own default rather than the mode 
on disk, so
   the bit is dropped at packaging time. The reporter ran into this installing 
Tomcat
   through sdkman (https://github.com/sdkman/sdkman-cli/issues/974).
   
   On the line endings in comment #1: they are already right for the scripts. 
`dist-static`
   sets `bin/*.sh` to LF, and `*.sh` is not in the `text.files` patternset that 
the
   `fixcrlf` pass at the top of `package-zip` uses, so the scripts stay LF 
while the text
   files stay CRLF. This change does not touch that; only the stored modes 
change.
   
   The new filesets mirror the ones in `package-tgz`: `conf` 0700 with 0600 
contents, then
   `bin`, `lib`, `logs`, `temp`, `webapps`, `work` and the top-level text files 
0750/0640,
   then `bin/*.sh` 0750 in a fileset of its own after the rest. The
   `<exclude name="bin/*.sh"/>` is needed because `<zip>` defaults to 
`duplicate="add"`:
   without it each script is stored twice, first at 0640 and then at 0750. 
`package-tgz`
   carries the same exclude for the same reason.
   
   Two things left as they are. The top-level `apache-tomcat-<version>/` entry 
keeps Ant's
   default 0755, because it comes from the `<zipfileset file="..." 
fullpath="..."/>` line
   rather than from the filesets; the `.tar.gz` has no such entry, so 
extracting it creates
   that directory from the umask, which is also 0755 with the usual 022. 
`package-winzip` is
   unchanged, as the Windows artifact. The deployer, embedded and source 
archives set no
   modes in either format, so `package-zip` was the only target where the ZIP 
and the
   tar.gz disagreed.
   
   Testing, since comment #1 asked for it. I ran the old and the new 
`package-zip` filesets
   and the `package-tgz` ones with Ant 1.10.15 over a stand-in `${tomcat.dist}` 
tree rather
   than a full `ant release`. The new ZIP stores the same permissions as the 
`.tar.gz` for
   every entry the two have in common:
   
   ```
                                                 before    after   tar.gz
   apache-tomcat-<version>/bin/                    0755     0750     0750
   apache-tomcat-<version>/bin/catalina.bat        0644     0640     0640
   apache-tomcat-<version>/bin/catalina.sh         0644     0750     0750
   apache-tomcat-<version>/conf/                   0755     0700     0700
   apache-tomcat-<version>/conf/server.xml         0644     0600     0600
   apache-tomcat-<version>/LICENSE                 0644     0640     0640
   ```
   
   Extracted with `unzip` under umask 022, `bin/catalina.sh` is 0644 before the 
change and
   running it fails with "permission denied"; after the change it is 0750 and 
runs. The
   entries were already written with `create_system` 3 (UNIX) before the 
change, so this
   changes the mode values rather than whether modes are stored at all, and no 
entry gets
   the DOS read-only attribute.
   
   (Saved at /Users/armanp/workspace/github-contributing/PR-tomcat-69902.md and 
PR-tomcat-69902.md.title. DRAFT — not sent. No AI attribution line, per the 
standing rule.)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to