crev-dev / cargo-crev

A cryptographically verifiable code review system for the cargo (Rust) package manager.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault with libgit2 1.4

dbrgn opened this issue · comments

When using cargo crev (either the released version or git master at 47cd386) on a system with libgit2 1.4.2 (e.g. on Arch Linux), cargo crev segfaults on cargo crev update.

       Message: Process 62853 (cargo-crev) of user 1000 dumped core.

                Module /home/danilo/Projects/cargo-crev/target/debug/cargo-crev with build-id bdfd3accf74a6eff130861c4ea5d4181beb0e7d9
                Module linux-vdso.so.1 with build-id 351b3072a0555d16594b35d390715fc2f77d54e3
                Module libbrotlicommon.so.1 with build-id a4ba3f4b4571c8272343b621da812a6e24a202a7
                Module libresolv.so.2 with build-id 46ffdf3d477a170314060c26927470d7399bc900
                Module libkeyutils.so.1 with build-id ac405ddd17be10ce538da3211415ee50c8f8df79
                Module libkrb5support.so.0 with build-id adf65240a4d2aba772d7a0772b4d015469934113
                Module libcom_err.so.2 with build-id 358b783c9b3d12ba8248519ea2e7f3da4c4e0297
                Module libk5crypto.so.3 with build-id eb8220b8f36675aac769450be4cb6bb7f97ec38a
                Module libkrb5.so.3 with build-id 72d26767c5cb1097db75a5f5bff88860233c902b
                Module libdl.so.2 with build-id bb9bd2657bfba9f60bd34d2050cc63a7eb024bc4
                Module libunistring.so.2 with build-id 015ac6d6bcb60b7d8bea31a80d1941b06e8636ab
                Module libpcre.so.1 with build-id 845483dd0acba86de9f0313102bebbaf3ce52767
                Module libhttp_parser.so.2.9 with build-id a7b44d494c1e52a62efd933ab2f7b37dae9482e1
                Module libpthread.so.0 with build-id 7fa8b52fae071a370ba4ca32bf9490a30aff31c4
                Module libbrotlidec.so.1 with build-id 45defc036e918e0140a72f1fbce6e7692d38241d
                Module libzstd.so.1 with build-id 72f3511cba7db578f6a2647925f35664da6c838b
                Module libgssapi_krb5.so.2 with build-id e6e098ad51ce7bdd3dbe902d7b0f69a90f8a9e08
                Module libcrypto.so.1.1 with build-id 4c926b672d97886b123e03a008387aecf0786de4
                Module libssl.so.1.1 with build-id 1024424ab33a3767da03f4fdb1fc1b02479f160f
                Module libpsl.so.5 with build-id 0229a201aaf5652186c9fdc192ebe52baf19d7f1
                Module libssh2.so.1 with build-id a4adfe44cc7ebd295b3b783361acc3dcfcea1d50
                Module libidn2.so.0 with build-id 1ce2b50ad9f9821c2c629b521cf5a3c99593d332
                Module libnghttp2.so.14 with build-id f2738fead8e6593084b4fb8756f460aa8cf5535a
                Module ld-linux-x86-64.so.2 with build-id c09c6f50f6bcec73c64a0b4be77eadb8f7202410
                Module libc.so.6 with build-id 85766e9d8458b16e9c7ce6e07c712c02b8471dbc
                Module libm.so.6 with build-id 596b63a006a4386dcab30912d2b54a7a61827b07
                Module libgcc_s.so.1 with build-id 5d817452a709ca3a213341555ddcf446ecee37fa
                Module libz.so.1 with build-id 0c1459c56513efd5d53eb3868290e9afee6a6a26
                Module libgit2.so.1.4 with build-id c0d036dddc2044070404f7ae5e65b4464588f4ca
                Module libcurl.so.4 with build-id d4dec3d9f8c789ec28d441f2a3f73d532809e6ef
                Stack trace of thread 62896:
                #0  0x00007fccc3001fc0 n/a (libgit2.so.1.4 + 0xa3fc0)
                #1  0x00007fccc3003aae git_remote_fetch (libgit2.so.1.4 + 0xa5aae)
                #2  0x00005587f44991a0 n/a (/home/danilo/Projects/cargo-crev/target/debug/cargo-crev + 0x17b21a0)
                #3  0x00005587f4569edd n/a (/home/danilo/Projects/cargo-crev/target/debug/cargo-crev + 0x1882edd)
                ELF object binary architecture: AMD x86-64

I think this is due to an ABI incompatibility introduced by libgit2. AFAIK this is fixed with git2 0.14 and tried to update to it, but it seems that the cargo crate (even 0.60) still depends on the older libgit2-sys version, so this didn't work.

diff --git a/cargo-crev/Cargo.toml b/cargo-crev/Cargo.toml
index 9025be2..4a0ded0 100644
--- a/cargo-crev/Cargo.toml
+++ b/cargo-crev/Cargo.toml
@@ -29,7 +29,7 @@ crev-wot = { path = "../crev-wot", version = "^0.23"}
 crev-lib = { path = "../crev-lib", version = "^0.23.0"}
 anyhow = "1.0.53"
 atty = "0.2.14"
-cargo = "0.59.0"
+cargo = "0.60.0"
 cargo-platform = "0.1.2"
 crates_io_api = "0.7.3"
 crossbeam = "0.8.1"
@@ -52,7 +52,7 @@ time = "0.3.6"
 tokei = "12.1.2"
 walkdir = "2.3.2"
 openssl-sys = "0.9.65"
-git2 = "0.13.23"
+git2 = "0.14.1"
 tempfile = "3.3.0"
 rprompt = "1.0.5"
 thiserror = "1.0.30"
diff --git a/crev-lib/Cargo.toml b/crev-lib/Cargo.toml
index 61acb60..885dc8d 100644
--- a/crev-lib/Cargo.toml
+++ b/crev-lib/Cargo.toml
@@ -22,7 +22,7 @@ crev-recursive-digest = "0.5"
 default = "0.1.2"
 directories = { version = "2", package = "directories-next" }
 fnv = "1.0.7"
-git2 = "0.13.23"
+git2 = "0.14.1"
 log = "0.4.14"
 num_cpus = "1.13.0"
 resiter = "0.4.0"

Maybe there's some other possibility of fixing this?

(Someone should really write a libgit2 replacement in pure Rust...)

We need to wait for a new cargo release, see rust-lang/cargo#10446.

Once that's out, bump cargo and git2 dependencies to the latest version and tag a new release.

As a temporary workaround, this does the trick:

diff --git a/cargo-crev/Cargo.toml b/cargo-crev/Cargo.toml
index 9025be2..e55592b 100644
--- a/cargo-crev/Cargo.toml
+++ b/cargo-crev/Cargo.toml
@@ -29,8 +29,8 @@ crev-wot = { path = "../crev-wot", version = "^0.23"}
 crev-lib = { path = "../crev-lib", version = "^0.23.0"}
 anyhow = "1.0.53"
 atty = "0.2.14"
-cargo = "0.59.0"
-cargo-platform = "0.1.2"
+cargo = { git = "https://github.com/rust-lang/cargo/" }
+cargo-platform = { git = "https://github.com/rust-lang/cargo/" }
 crates_io_api = "0.7.3"
 crossbeam = "0.8.1"
 chrono = { version = "0.4.19", default-features = false }
@@ -52,7 +52,7 @@ time = "0.3.6"
 tokei = "12.1.2"
 walkdir = "2.3.2"
 openssl-sys = "0.9.65"
-git2 = "0.13.23"
+git2 = "0.14"
 tempfile = "3.3.0"
 rprompt = "1.0.5"
 thiserror = "1.0.30"
diff --git a/crev-lib/Cargo.toml b/crev-lib/Cargo.toml
index 61acb60..3822316 100644
--- a/crev-lib/Cargo.toml
+++ b/crev-lib/Cargo.toml
@@ -22,7 +22,7 @@ crev-recursive-digest = "0.5"
 default = "0.1.2"
 directories = { version = "2", package = "directories-next" }
 fnv = "1.0.7"
-git2 = "0.13.23"
+git2 = "0.14"
 log = "0.4.14"
 num_cpus = "1.13.0"
 resiter = "0.4.0"
commented

We need to wait for a new cargo release, see rust-lang/cargo#10446.

Once that's out, bump cargo and git2 dependencies to the latest version and tag a new release.

rust-lang/cargo#10446 appears to have been fixed in v0.61.1