Skip to content

Commit

Permalink
fix(IDX): work around libssh2-sys determinism issues
Browse files Browse the repository at this point in the history
This adds a patch that prevents `libssh2-sys` from generating a `.pc`
file. The pkg-config file includes absolute paths which makes it
non-deterministic.

See: alexcrichton/ssh2-rs#340
  • Loading branch information
nmattia committed Dec 16, 2024
1 parent 5f9c28b commit 8dc2bfc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
5 changes: 5 additions & 0 deletions bazel/external_crates.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def external_crates_repository(name, cargo_lockfile, lockfile, sanitizers_enable
patch_args = ["-p1"],
patches = ["@@//bazel:cc_rs.patch"],
)],
"libssh2-sys": [crate.annotation(
# Patch for determinism issues
patch_args = ["-p1"],
patches = ["@@//bazel:libssh2-sys.patch"],
)],
"curve25519-dalek": [crate.annotation(
rustc_flags = [
"-C",
Expand Down
22 changes: 22 additions & 0 deletions bazel/libssh2-sys.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Patch for determinism issues
# https://github.com/alexcrichton/ssh2-rs/issues/340
diff --git a/build.rs b/build.rs
index c4425ee..f99f132 100644
--- a/build.rs
+++ b/build.rs
@@ -173,6 +173,7 @@ fn main() {
.unwrap();
let version = &version_line[version_line.find('"').unwrap() + 1..version_line.len() - 1];

+ /*
let pkgconfig = dst.join("lib/pkgconfig");
fs::create_dir_all(&pkgconfig).unwrap();
fs::write(
@@ -188,6 +189,7 @@ fn main() {
.replace("@LIBSSH2VER@", version),
)
.unwrap();
+ */

cfg.warnings(false);
cfg.compile("ssh2");

0 comments on commit 8dc2bfc

Please sign in to comment.