Skip to content

update submodule libgit2 to new commit to fix 'omits non-default port numbers' #421

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

Merged
merged 7 commits into from
May 23, 2019

Conversation

bhamail
Copy link
Contributor

@bhamail bhamail commented May 17, 2019

Update submodule commit to use fixed version of libgit2 - #405

@bhamail
Copy link
Contributor Author

bhamail commented May 17, 2019

Hm. Not sure what is causing the "Some checks were not successful" failures.

In the libgit2-sys/libgit2 submodule folder, I ran git checkout 4ef2b889a.
Back in the top level folder I ran cargo test, and all was well.

Perhaps the CI builds should run cargo clean first?

@ehuss
Copy link
Contributor

ehuss commented May 18, 2019

@bhamail There is a separate package that needs to be run separately (cargo run --manifest-path systest/Cargo.toml). You can see the commands that run during CI in the config (https://github.com/rust-lang/git2-rs/blob/master/ci/azure-test-all.yml).

Also, I would expect it would be good to update to the latest release, and there will likely be some work necessary to deal with any breakage and build issues.

@bhamail
Copy link
Contributor Author

bhamail commented May 20, 2019

@ehuss Thanks for looking this over. I tried to drill into the cause of the failures of the systest command, but I'm stuck. Here's the error (w/ backtrace). FWIW, I did a cargo clean on both the top level project and the submodule before this error.

The details of the CI build failures seem to be showing this same error, so maybe we'll get lucky and fixing this error will fix them all.

export RUST_BACKTRACE=1
cargo run --manifest-path systest/Cargo.toml
...
    Finished dev [unoptimized + debuginfo] target(s) in 2.78s
     Running `target/debug/systest`
RUNNING ALL TESTS
bad GIT_DIFF_INDENT_HEURISTIC value at byte 2: rust: 0 (0x0) != c 4 (0x4)
bad GIT_DIFF_INDENT_HEURISTIC value at byte 3: rust: 128 (0x80) != c 0 (0x0)
thread 'main' panicked at 'some tests failed', /Users/bhamail/sonatype/community/rust/git2-rs/target/debug/build/systest-05071433ad5c0557/out/all.rs:13:21
stack backtrace:
   0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace
             at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49
   1: std::sys_common::backtrace::_print
             at src/libstd/sys_common/backtrace.rs:71
   2: std::panicking::default_hook::{{closure}}
             at src/libstd/sys_common/backtrace.rs:59
             at src/libstd/panicking.rs:211
   3: std::panicking::default_hook
             at src/libstd/panicking.rs:227
   4: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:491
   5: std::panicking::begin_panic
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/panicking.rs:425
   6: systest::main
             at ./target/debug/build/systest-05071433ad5c0557/out/all.rs:13
   7: std::rt::lang_start::{{closure}}
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:74
   8: std::panicking::try::do_call
             at src/libstd/rt.rs:59
             at src/libstd/panicking.rs:310
   9: panic_unwind::dwarf::eh::read_encoded_pointer
             at src/libpanic_unwind/lib.rs:102
  10: <std::panicking::begin_panic::PanicPayload<A> as core::panic::BoxMeUp>::get
             at src/libstd/panicking.rs:289
             at src/libstd/panic.rs:398
             at src/libstd/rt.rs:58
  11: std::rt::lang_start
             at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:74
  12: <usize as systest::Pretty>::pretty

I'm not sure where to dig next.

Re 'latest release': I did initially try updating to the latest libgit2 release, but ran into some build errors that I was unable to fix the first few times around. If we could get this smaller patch merged, that would resolve the current log jam. I'm willing to come back and work on updating to the latest release after that (w/ the assumption I'll be pestering you with more of my silly noob questions).

@ehuss
Copy link
Contributor

ehuss commented May 21, 2019

The ctest is showing that the GIT_DIFF_INDENT_HEURISTIC const value has changed to 1 << 18. In libgit2-sys/lib.rs that constant value needs to change.

Also, I'm getting a seg fault in the all test. It looks like due to the introduction of custom allocators, git2_curl::register needs to call libgit2_sys::init first. I don't immediately see anything else that needs to do that, hopefully there is enough coverage in the tests to ensure that.

@bhamail
Copy link
Contributor Author

bhamail commented May 21, 2019

Zoinks! It appears the CI build is happy now. Thanks @ehuss for the help!

@@ -15,6 +15,7 @@ const PORT: u16 = 7848;

fn main() {
unsafe {
libgit2_sys::init();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems somewhat suspicious in the sense that git2_curl should internally not require this but instead do it on behalf of libraries. I think that there's perhaps a missing call to initialization somewhere inside of git2 itself, since git2_curl only uses the APIs of git2?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, I meant that init should be called from git2_curl::register, not with.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I moved the init call into git2_curl::register. 69334f8
Feels like I'm missing a way to get this init'd without adding a direct dependency on libgit2_sys, but I'm not seeing it. (noob alert).

@@ -23,6 +23,7 @@ civet = "0.11"
conduit = "0.8"
conduit-git-http-backend = "0.8"
tempfile = "3.0"
libgit2-sys = { path = "../libgit2-sys"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't publish without a version.

Copy link
Contributor Author

@bhamail bhamail May 22, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 437e22e

For my own learning: I was guessing a version was not needed due to no version declared in this other case for 'systest':
https://github.com/rust-lang/git2-rs/blob/master/systest/Cargo.toml#L8

I guess there is no magic that inherits the version from the higher level https://github.com/rust-lang/git2-rs/blob/master/Cargo.toml#L26 ?

@@ -1112,7 +1112,7 @@ pub const GIT_DIFF_SHOW_UNMODIFIED: git_diff_option_t = 1 << 26;
pub const GIT_DIFF_PATIENCE: git_diff_option_t = 1 << 28;
pub const GIT_DIFF_MINIMAL: git_diff_option_t = 1 << 29;
pub const GIT_DIFF_SHOW_BINARY: git_diff_option_t = 1 << 30;
pub const GIT_DIFF_INDENT_HEURISTIC: git_diff_option_t = 1 << 31;
pub const GIT_DIFF_INDENT_HEURISTIC: git_diff_option_t = 1 << 18;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you keep this numerically sorted with the others?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing. Done in 2538388

@@ -75,6 +75,7 @@ pub unsafe fn register(handle: Easy) {
let handle = Arc::new(Mutex::new(handle));
let handle2 = handle.clone();
INIT.call_once(move || {
libgit2_sys::init();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general we try to auto-initialize libgit2 from the git2 wrapper crate, so could this call actually be moved into git2::transport::register? I think there's a top-level ::init() function as well in that crate

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alexcrichton alexcrichton merged commit ff12cad into rust-lang:master May 23, 2019
@alexcrichton
Copy link
Member

👍

@ehuss
Copy link
Contributor

ehuss commented May 23, 2019

Ah, yea, this is definitely better, sorry for the confusion!

@bhamail Do you think you'll be able to look at further updating to a newer version from here? If not, I can take a look at the build issues.

@bhamail
Copy link
Contributor Author

bhamail commented May 23, 2019

@ehuss Feel free to look into build errors with a newer version. I will try to take a look next week, if you haven't already done it. Thanks again for all the help.

@bhamail
Copy link
Contributor Author

bhamail commented Jun 13, 2019

@ehuss I finally got back to trying to build against the latest libgit2. I was happy to find @cuviper beat me to it, and has already updated to the latest release from that project (#425). Thanks @cuviper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants