otar (thus Tar_gz) cannot decompress itself, with the source archive generated by GitHub.
$ cd $(mktemp -d) || exit
$ curl -LO 'https://github.com/mirage/ocaml-tar/archive/refs/heads/main.tar.gz'
$ tar tzf main.tar.gz
ocaml-tar-main/
ocaml-tar-main/.gitattributes
ocaml-tar-main/.github/
ocaml-tar-main/.github/workflows/
# omitted for sobriety
$ otar list main.tar.gz
Fatal error: exception Tar.Header.Checksum_mismatch
Raised at Tar.Header.unmarshal in file "lib/tar.ml", line 378, characters 35-58
Called from Tar.HeaderReader.read.next_block.(fun) in file "lib/tar.ml", line 536, characters 13-45
Called from Tar.HeaderReader.read.get_hdr in file "lib/tar.ml", line 546, characters 6-13
Called from Tar.HeaderReader.read in file "lib/tar.ml", line 606, characters 4-14
Called from Tar_gz.Make.get_next_header in file "lib/tar_gz.ml", line 127, characters 4-36
Called from Dune__exe__Otar.list.go in file "bin/otar.ml", line 107, characters 24-49
Called from Dune__exe__Otar in file "bin/otar.ml", line 124, characters 4-17
otar
(thusTar_gz
) cannot decompress itself, with the source archive generated by GitHub.They're generating POSIX tar archives.