Skip to content

Assertion failed on Bundle::write_to_directory #254

@mellowagain

Description

@mellowagain

With some (not all!) git receive-pack payloads and their PACK files, Bundle::write_to_directory will fail an assert and panic with:

thread 'actix-rt:worker:0' panicked at 'assertion failed: `(left == right)`
  left: `4`,
 right: `3`: This should not happen unless we added more nodes than were declared in the constructor'

Sending the payload normally just into git receive-pack does not cause an error and Git correctly handles it and applies the changes.

Backtrace:

stack backtrace:
  0..17: <Rust standard library panic calls>
  18:     0x7ff6383c1a9c - git_pack::cache::delta::Tree<git_pack::index::write::TreeEntry>::iter_root_chunks<git_pack::index::write::TreeEntry>
                               at C:\Users\Mari\.cargo\git\checkouts\gitoxide-c24b7a97d5eace1a\c0fc4f6\git-pack\src\cache\delta\iter.rs:8
  19:     0x7ff6383c2152 - git_pack::cache::delta::Tree<git_pack::index::write::TreeEntry>::traverse<git_pack::index::write::TreeEntry,git_pack::bundle::write::new_pack_file_resolver::closure$1,prodash::progress::utils::Discard,git_pack::index::write::impl$1::write_data_iter_to_str
                               at C:\Users\Mari\.cargo\git\checkouts\gitoxide-c24b7a97d5eace1a\c0fc4f6\git-pack\src\cache\delta\traverse\mod.rs:101
  20:     0x7ff63860c071 - git_pack::index::File::write_data_iter_to_stream<git_pack::bundle::write::impl$0::inner_write::closure$0,git_pack::bundle::write::new_pack_file_resolver::closure$1,alloc::boxed::Box<dyn$<core::iter::traits::iterator::Iterator,assoc$<Item,enum$<core::resul
                               at C:\Users\Mari\.cargo\git\checkouts\gitoxide-c24b7a97d5eace1a\c0fc4f6\git-pack\src\index\write\mod.rs:168
  21:     0x7ff63850c608 - git_pack::Bundle::inner_write<ref$<ref$<tempfile::dir::TempDir> >,prodash::progress::utils::Discard,alloc::boxed::Box<dyn$<core::iter::traits::iterator::Iterator,assoc$<Item,enum$<core::result::Result<git_pack::data::input::Entry,enum$<git_pack::data::inp
                               at C:\Users\Mari\.cargo\git\checkouts\gitoxide-c24b7a97d5eace1a\c0fc4f6\git-pack\src\bundle\write\mod.rs:233
  22:     0x7ff63850dad7 - git_pack::Bundle::write_to_directory<std::io::buffered::bufreader::BufReader<slice$<u8> >,ref$<ref$<tempfile::dir::TempDir> >,prodash::progress::utils::Discard>
                               at C:\Users\Mari\.cargo\git\checkouts\gitoxide-c24b7a97d5eace1a\c0fc4f6\git-pack\src\bundle\write\mod.rs:110
  23:     0x7ff6384a24cc - gitarena::git::pack::write_to_fs::generator$0::generator$0::generator$0<ref_mut$<sqlx_core::transaction::Transaction<sqlx_core::postgres::database::Postgres> > >
                               at C:\Users\Mari\Programming\gitarena\src\git\pack.rs:45

Example payload that does cause the assertion failure

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions