-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Description
Description
Had to dig to understand what happened.
It started with retrieving a git repo in Gitea as an archive and having tar failing on it complaining it is not a tar archive.
Thing is, it was a gzip archive. Then after a gunzip, the .tar file was in fact a ... gzip file too.
Here are the shell commands to demonstrate this, but you can also use 7zip in a file browser, it will show an extra level with the archive name and no extension before having the first directory level.
$ wget https://gitea..../repo-master.tar.gz
$ tar xzvf repo-master.tar.gz
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Exiting with failure status due to previous errors
$ file repo-master.tar.gz
repo-master.tar.gz: gzip compressed data, original size modulo 2^32 1008078
$ gunzip repo-master.tar.gz
$ ls
repo-master.tar
$ file repo-master.tar
repo-master.tar: gzip compressed data, from Unix, original size modulo 2^32 6912000
$ tar xzvf repo-master.tar
(...)
Data uncompressed correctly
It went under the radar for a while as I rarely use this mechanism with the Gitea instance.
While digging in the configuration I found that I had the parameter ENABLE_GZIP = true
There is no additional parameter related to tar.*.command as stated in #26620 . Gitea has the default behavior here.
As sometimes there can be a problem due to the reverse proxy nginx in front wich also has gzip=on, I did some tests without it.
It was completely bypassed, connected directly to the gitea instance/port.
Results are :
- zip files are correct in all situations
- with ENABLE_GZIP = true, the downloaded tgz/tar.gz files are compressed in gzip a second time.
It is worth noting the files generated by Gitea in its cache underrepo-archive/*hash*.tar.gz
are valid. - with ENABLE_GZIP = false the downloaded tgz/tar.gz files are valid.
Included those who were already generated and still in Gitea local cache.
I also think ENABLE_GZIP does not do what is stated in the documentation : when set to false, without a reverse proxy most of the data was still sent gzipped. What is the real use for ?
Gitea Version
1.21.9 and 1.21.11
Can you reproduce the bug on the Gitea demo site?
No
Log Gist
No response
Screenshots
No response
Git Version
2.17.1
Operating System
Ubuntu 18.04
How are you running Gitea?
Binary release from https://github.com/go-gitea/gitea/releases
Launched by systemd
Database
SQLite