You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 29, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 29, 2023. It is now read-only.
Gerrit tarballs for the base packages aren't deterministic #84
Downloading this URL: https://go.googlesource.com/net/+archive/d75b190.tar.gz?dummy=/golang-net-d75b190.tgz
always produces a different tar archive. Contents are the same, but tar metadata is
different. This prevents using such URLs as fingerprinted distfiles in FreeBSD.
It might be that https://go.googlesource.com uses BSD tar that suffers from this bug:
libarchive/libarchive#623 (in this case the fix is switching to GNU tar).
Reported by None on 2015-12-13 16:27:54
Reacted by Greg Horn, Michael Weiss, Victor Gavro and Timo Tijhof
Downloading this URL: https://go.googlesource.com/net/+archive/d75b190.tar.gz?dummy=/golang-net-d75b190.tgz
always produces a different tar archive. Contents are the same, but tar metadata is
different. This prevents using such URLs as fingerprinted distfiles in FreeBSD.
It might be that https://go.googlesource.com uses BSD tar that suffers from this bug:
libarchive/libarchive#623 (in this case the fix is switching to GNU tar).
Thanks for filing this bug. Its not Gerrit, but Gitiles that generates these (and even
then I think its JGit's fault). But its certainly not Gerrit. So I'm going to move
this over to the Gitiles project where its more likely to get attention.
FWIW, this makes it somewhat annoying to follow Bazel best practices when using http_archive for external dependencies hosted on googlesource.com. Specifically, the best practices are to use http_archive rather than git_repository and to include a sha256sum.
Reacted by Greg Horn, Jean-Baptiste Louazel and Mizux Seiha
FYI, this is pretty unlikely to be fixed due to needing to break a public API inside JGit, which requires a major version bump, and that doesn't happen often.
The best practice to get files from Git is to use the Git wire protocol to git clone the repository. If only a single version is needed, use --depth 1 to get a shallow clone.
If Bazel doesn't want to use Git to fetch source files from Git, then best practice should be to export the files as a tarball and store that tarball in another, non-Git persistent location where the exact bytes of that stream are unlikely to change.
Attempting to checksum a dynamically created .tar.bz2 or .tar.gz stream is not a good idea, as the compressor can change over time and produce different compressed stream results that still inflate to the same original files.
Reacted by Jakub Jirutka, Preston Van Loon, Ari Fogel, Aaron Madlon-Kay, Nick Doyle, Michael Weiss, Issam E. Maghni, Hans-Christoph Steiner and Jonathan
Bazel can use git directly, but it doesn't support shallow clones and therefore unnecessarily fetches all of the history for a repo. Their suggestion is to use http_archive to fetch a tarball for this use case.
IMHO there should be a feature request against Bazel to support shallow clones. It should be trivial to add the --shallow flag.
As Shawn says, using a dynamically generated compressed file is still a bad idea for this use case. Even if we fix JGit/Gitiles to generate a deterministic sequence of bytes at a given server version, we have no way to ensure that the given sequence of bytes remains deterministic across server versions. We may depend on the JDK's zlib implementation for compressing objects, and there is no guarantee that that implementation is going to always produce the same byte sequence across JDK versions. Similarly, we use Apache Commons Compress for generating the archives, and we have no guarantee that a given list of archive entries is always going to contain the same bytes of metadata even if the compressed content is the same. The upshot is that callers really should not depend on the sequence of bytes in an archive being stable in the long term, which is what the Bazel use case is asking for.
you could write a custom repository rule that runs a git clone/fetch of a specific revision to implement shawn's suggestion. Beyond fixing the direct issue, I think that would also be a good direction for Bazel to take, so Bazel can stop depending on JGit.
Attempting to checksum a dynamically created .tar.bz2 or .tar.gz stream is not a good idea, as the compressor can change over time and produce different compressed stream results that still inflate to the same original files.
This has been true from the start. Unless we
a. Store the tarball when a user downloads it (this is what GitHub does), or
b. Keep around historical versions of commons-compress and record which one was used to produce the tarball
we cannot make a long term deterministic tarball download. All the requests I have seen are for use cases that require long term determinism. In that spirit, it would be misleading to pretend we intend to provide that; it is expensive to do and not part of what Gitiles is meant for.
If you don't need determinism, you can use the Gitiles tarball. If you do need determinism, I recommend storing the tarball somewhere (e.g. a cloud storage provider or an ftp host).
(a) can we make this a hosting config option? I get that storing archives for every project and every commit is a ton of space and would be pretty wasteful (especially if crawlers fire). I wonder if a middle ground of doing it only for tags would work.
(b) how big of a problem is this approach? gitiles doesn't seem to change that much (for better or worse). what if we did this? not entirely unrelated, but the gzip project has an rsync option so compressed files are stable and easy to transfer.
I'm still seeing the timestamp in the tar metadata when downloading from googlesource.com. So this is not yet resolved. It looks like it was already fixed in JGit. I added more info in #217
Activity
spearce commentedon Dec 2, 2016
Reported by
Noneon 2015-12-13 16:27:54spearce commentedon Dec 2, 2016
Reported by
Noneon 2015-12-14 07:03:42shahms commentedon Dec 27, 2016
FWIW, this makes it somewhat annoying to follow Bazel best practices when using
http_archivefor external dependencies hosted on googlesource.com. Specifically, the best practices are to usehttp_archiverather thangit_repositoryand to include asha256sum.spearce commentedon Dec 30, 2016
FYI, this is pretty unlikely to be fixed due to needing to break a public API inside JGit, which requires a major version bump, and that doesn't happen often.
The best practice to get files from Git is to use the Git wire protocol to
git clonethe repository. If only a single version is needed, use--depth 1to get a shallow clone.If Bazel doesn't want to use Git to fetch source files from Git, then best practice should be to export the files as a tarball and store that tarball in another, non-Git persistent location where the exact bytes of that stream are unlikely to change.
Attempting to checksum a dynamically created .tar.bz2 or .tar.gz stream is not a good idea, as the compressor can change over time and produce different compressed stream results that still inflate to the same original files.
shahms commentedon Jan 3, 2017
Bazel can use git directly, but it doesn't support shallow clones and therefore unnecessarily fetches all of the history for a repo. Their suggestion is to use
http_archiveto fetch a tarball for this use case.dborowitz commentedon Jan 4, 2017
IMHO there should be a feature request against Bazel to support shallow clones. It should be trivial to add the
--shallowflag.As Shawn says, using a dynamically generated compressed file is still a bad idea for this use case. Even if we fix JGit/Gitiles to generate a deterministic sequence of bytes at a given server version, we have no way to ensure that the given sequence of bytes remains deterministic across server versions. We may depend on the JDK's zlib implementation for compressing objects, and there is no guarantee that that implementation is going to always produce the same byte sequence across JDK versions. Similarly, we use Apache Commons Compress for generating the archives, and we have no guarantee that a given list of archive entries is always going to contain the same bytes of metadata even if the compressed content is the same. The upshot is that callers really should not depend on the sequence of bytes in an archive being stable in the long term, which is what the Bazel use case is asking for.
hanwen commentedon Jan 9, 2017
you could write a custom repository rule that runs a git clone/fetch of a specific revision to implement shawn's suggestion. Beyond fixing the direct issue, I think that would also be a good direction for Bazel to take, so Bazel can stop depending on JGit.
Remove android.googlesource.com tarball hashes
Remove android.googlesource.com tarball hashes
5 remaining items
vapier commentedon Jun 7, 2020
unfortunately, it has not, and it doesn't seem like it will be :/
ryandesign commentedon Sep 24, 2020
Whom do we need to contact to get that fixed?
hanwen commentedon Sep 24, 2020
googlesource.com runs JGit from master, so if this is still non-deterministic, something else is going on.
ryandesign commentedon Sep 24, 2020
It is: note different Content-Length on different runs of trying to fetch the same commit:
mohd-akram commentedon Mar 26, 2021
This is still happening.
jrn commentedon Mar 26, 2021
This has been true from the start. Unless we
a. Store the tarball when a user downloads it (this is what GitHub does), or
b. Keep around historical versions of commons-compress and record which one was used to produce the tarball
we cannot make a long term deterministic tarball download. All the requests I have seen are for use cases that require long term determinism. In that spirit, it would be misleading to pretend we intend to provide that; it is expensive to do and not part of what Gitiles is meant for.
If you don't need determinism, you can use the Gitiles tarball. If you do need determinism, I recommend storing the tarball somewhere (e.g. a cloud storage provider or an ftp host).
vapier commentedon Mar 28, 2021
(a) can we make this a hosting config option? I get that storing archives for every project and every commit is a ton of space and would be pretty wasteful (especially if crawlers fire). I wonder if a middle ground of doing it only for tags would work.
(b) how big of a problem is this approach? gitiles doesn't seem to change that much (for better or worse). what if we did this? not entirely unrelated, but the gzip project has an rsync option so compressed files are stable and easy to transfer.
aom: new port
libaom: 3.0.0 -> 3.1.0
eighthave commentedon Dec 13, 2021
I'm still seeing the timestamp in the tar metadata when downloading from googlesource.com. So this is not yet resolved. It looks like it was already fixed in JGit. I added more info in #217
ryandesign commentedon Jun 3, 2022
Why is this issue closed? The problem was never fixed. Please reopen.
_dl.sh: document why we cannot use the canonical boringssl repo [ci s…
dev-games/aseprite: regenerate Manifest
dev-games/aseprite: regenerate Manifest