jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

`.tgz` files are double-gzipped

Open basil opened this issue 1 year ago • 0 comments
trafficstars

Jetty version(s)

12.0.14

Jetty Environment

EE 9 EE 10

Java version/vendor

openjdk version "17.0.12" 2024-07-16
OpenJDK Runtime Environment (build 17.0.12+7-Ubuntu-1ubuntu222.04)
OpenJDK 64-Bit Server VM (build 17.0.12+7-Ubuntu-1ubuntu222.04, mixed mode, sharing)

OS type/version

Ubuntu 22.04.5 LTS x86_64

Context

See JENKINS-73942.

Steps to reproduce

$ wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-home/12.0.14/jetty-home-12.0.14.tar.gz
$ tar -xzvf jetty-home-12.0.14.tar.gz
$ export JETTY_HOME=/path/to/jetty-home-12.0.14
$ git clone https://github.com/basil/jetty-tgz-repro.git
$ export JETTY_BASE=/path/to/jetty-tgz-repro

Observe the files are identical:

$ sha256sum $JETTY_BASE/webapps/static/resources/example.tar.gz $JETTY_BASE/webapps/static/resources/example.tgz
45749065add6664e1fc7c5a75665dd9dac85f70a1444612b895b222538601a13  webapps/static/resources/example.tar.gz
45749065add6664e1fc7c5a75665dd9dac85f70a1444612b895b222538601a13  webapps/static/resources/example.tgz

Start the server:

$ $JETTY_HOME/bin/jetty.sh start

Visit http://127.0.0.1:8080/static/ in Firefox and download both files.

Expected results

The files should be identical.

Actual results

The files are not identical, as the .tgz file is (erroneously!) double-gzipped. The .tar.gz file is correct.

$ sha256sum example.tar.gz example.tgz 
45749065add6664e1fc7c5a75665dd9dac85f70a1444612b895b222538601a13  example.tar.gz
1ca0c922947f4426b90526f3ec5427d2123b4b6fec92e66f8b14cec792271dae  example.tgz

Note

The problem only appears when the gzip module is enabled.

The problem disappeared after I unzipped $JETTY_HOME/lib/jetty-http-12.0.14.jar, updated org/eclipse/jetty/http/mime.properties to replace tgz=application/x-gtar with tgz=application/gzip, re-packed the JAR, and relaunched Jetty.

basil avatar Oct 16 '24 22:10 basil