-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http_archive: hash of content file different from origin file #20090
Comments
Hi @honwen, Could you please elaborate on your query with complete details? Thanks! |
@sgowroji a way to reproduct problem #!/bin/bash
ws_root=/tmp/demo
url=https://github.com/astral-sh/ruff/releases/download/v0.1.4/ruff-x86_64-apple-darwin.tar.gz
mkdir -p $ws_root
cd $ws_root
wget -q $url
sha256=$(sha256sum $(basename $url) | awk '{print $1}')
tar -zxf $(basename $url)
echo "# Hash of origin"
sha256sum ruff
cat <<EOF >WORKSPACE
workspace(
name = "demo",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "ruff_macos",
build_file_content = """exports_files(["ruff"], visibility = ["//visibility:public"])""",
sha256 = "$sha256",
url = "$url",
)
EOF
bazel build @ruff_macos//:ruff
echo "# Hash of bazel http_archive"
sha256sum $(bazel info output_base)/external/ruff_macos/ruff log:
problem
|
|
file files the problem is this two files' hash is not the same |
My apologies, you are entirely correct. It appears that the file in
(Note that Interestingly, these bytes also appear in the decompressed
Given the appearance of the string |
By upgrading to the latest version of the Apache Commons compress library. Fixes bazelbuild#20090.
By upgrading to the latest version of the Apache Commons compress library. Fixes bazelbuild#20090.
By upgrading to the latest version of the Apache Commons compress library. Fixes bazelbuild#20090.
By upgrading to the latest version of the Apache Commons compress library. Fixes bazelbuild#20090.
Awesome, thank you @tjgq ! I was struggling to diagnose this since it seemed very unlikely that the "bug is in the compiler". Really appreciate your fast turnaround on a fix. |
By upgrading to the latest version of the Apache Commons compress library. Fixes bazelbuild#20090.
By upgrading to the latest version of the Apache Commons compress library. Fixes bazelbuild#20090.
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes bazelbuild#20090.
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes bazelbuild#20090.
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes bazelbuild#20090.
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes #20090. Closes #20110. PiperOrigin-RevId: 580935354 Change-Id: I6c9728ac3fd925432f44a55efaef8f5b52d428c0
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes #20090. Closes #20110. Commit 93729f4 PiperOrigin-RevId: 580935354 Change-Id: I6c9728ac3fd925432f44a55efaef8f5b52d428c0 --------- Co-authored-by: Tiago Quelhas <tjgq@google.com>
Awesome |
I am running in the same issue
Same result with the last 3 versions of ruff |
@FrancoisPoinsot Can you please file a new issue for this? We'll look into this asap. |
I can reproduce this locally, filed #20269 |
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes #20090. Closes #20110. PiperOrigin-RevId: 580935354 Change-Id: I6c9728ac3fd925432f44a55efaef8f5b52d428c0
By upgrading the Apache Commons Compress library to 1.20. I'm deliberately not upgrading to the most recent one (1.24.0) because it would require an additional JDK module (java.desktop) and significantly regress the binary size. Fixes #20090. Closes #20110. PiperOrigin-RevId: 580935354 Change-Id: I6c9728ac3fd925432f44a55efaef8f5b52d428c0 Co-authored-by: Tiago Quelhas <tjgq@google.com>
6.5.0rc1 does not fix this $ bazel version
Bazelisk version: v1.19.0
Build label: 6.5.0rc1
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Jan 12 16:16:29 2024 (1705076189)
Build timestamp: 1705076189
Build timestamp as int: 1705076189 $ bazel build @ruff_macos//:ruff
INFO: Repository ruff_macos instantiated at:
/dummy/WORKSPACE:7:13: in <toplevel>
Repository rule http_archive defined at:
/root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/bazel_tools/tools/build_defs/repo/http.bzl:372:31: in <toplevel>
INFO: repository @ruff_macos' used the following cache hits instead of downloading the corresponding file.
* Hash '27a2800606b417d8f3102354efd0c09b8e08c94f754aaea9809a74a76e7456da' for https://github.com/astral-sh/ruff/releases/download/v0.1.4/ruff-x86_64-apple-darwin.tar.gz
If the definition of 'repository @ruff_macos' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'ruff_macos':
Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error extracting /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos/temp11281371888047318188/ruff-x86_64-apple-darwin.tar.gz to /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos/temp11281371888047318188: Truncated TAR archive
ERROR: /codematrix/release/WORKSPACE:7:13: fetching http_archive rule //external:ruff_macos: Traceback (most recent call last):
File "/root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/bazel_tools/tools/build_defs/repo/http.bzl", line 132, column 45, in _http_archive_impl
download_info = ctx.download_and_extract(
Error in download_and_extract: java.io.IOException: Error extracting /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos/temp11281371888047318188/ruff-x86_64-apple-darwin.tar.gz to /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos/temp11281371888047318188: Truncated TAR archive
ERROR: java.io.IOException: Error extracting /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos/temp11281371888047318188/ruff-x86_64-apple-darwin.tar.gz to /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos/temp11281371888047318188: Truncated TAR archive
INFO: Elapsed time: 0.080s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Fetching /root/.cache/bazel/_bazel_root/055f5651039f56d0c617210297f70629/external/ruff_macos; Extracting ruff-x86_64-apple-darwin.tar.gz |
The associated bug isn't fixed, so this should probably be reopened. |
We might want to try upgrading to Apache Commons Compress 1.25 instead of 1.20 (I chose 1.20 for binary size reasons; I no longer recall if I actually tried 1.25 first, sorry) and file a bug against them with the offending file if it doesn't work. |
1.25 doesn't work either. I have an open issue against them at https://issues.apache.org/jira/projects/COMPRESS/issues/COMPRESS-654
Let's not reopen this one. This issue is about sparse archives not being supported at all, and was fixed by upgrading Apache Commons Compress. #20269 is about Apache Commons Compress running into trouble with certain valid sparse archives. |
Description of the bug:
hash of content file different from origin file
Which category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSPACE
:Flow:
bazel build @ruff_macos//:ruff
sha256sum $(bazel info output_base)/external/ruff_macos/ruff
cbb610d58da995d6cee14804e088be7e2ece50f85b7b3afef3fa7e617af522de
but origin file hash(sha256sum) is
c644ed5d190a4db8b153e84b25e45ae4ed00be7e690d802feeecee22876f4a22 ruff
Which operating system are you running Bazel on?
linux(x86-64), macos(m1)
What is the output of
bazel info release
?release 6.4.0
The text was updated successfully, but these errors were encountered: