cargo-bundle
cargo-bundle copied to clipboard
crashes in libflate
When running with cargo bundle --release
to create a deb we sometimes get the crash
thread 'main' panicked at 'index out of bounds: the len is 15 but the index is 15', /home/blarsen/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libflate-0.1.27/src/huffman.rs:217:9
stack backtrace:
0: 0x55ae8d6504ea - std::backtrace_rs::backtrace::libunwind::trace::h9a6b80bbf328ba5d
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
1: 0x55ae8d6504ea - std::backtrace_rs::backtrace::trace_unsynchronized::hd162ec543a11886b
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x55ae8d6504ea - std::sys_common::backtrace::_print_fmt::h78a5099be12f51a6
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:65:5
3: 0x55ae8d6504ea - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::ha1c5390454d74f71
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:44:22
4: 0x55ae8d67678f - core::fmt::write::h9ffde816c577717b
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/fmt/mod.rs:1254:17
5: 0x55ae8d64cb85 - std::io::Write::write_fmt::h88186074961638e4
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/io/mod.rs:1698:15
6: 0x55ae8d6502b5 - std::sys_common::backtrace::_print::h184198273ed08d59
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:47:5
7: 0x55ae8d6502b5 - std::sys_common::backtrace::print::h1b4d8e7add699453
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:34:9
8: 0x55ae8d65195e - std::panicking::default_hook::{{closure}}::h393bcea75423915a
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:269:22
9: 0x55ae8d651705 - std::panicking::default_hook::h48c64f31d8b3fd03
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:288:9
10: 0x55ae8d651ebe - std::panicking::rust_panic_with_hook::hafdc493a79370062
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:691:13
11: 0x55ae8d651db9 - std::panicking::begin_panic_handler::{{closure}}::h0a64bc82e36bedc7
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:582:13
12: 0x55ae8d650956 - std::sys_common::backtrace::__rust_end_short_backtrace::hc203444fb7416a16
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/sys_common/backtrace.rs:150:18
13: 0x55ae8d651b12 - rust_begin_unwind
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
14: 0x55ae8d42e4d3 - core::panicking::panic_fmt::h0f6ef0178afce4f2
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
15: 0x55ae8d42e642 - core::panicking::panic_bounds_check::h937aba65fb5d17a6
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:162:5
16: 0x55ae8d458448 - <libflate::deflate::symbol::DynamicHuffmanCodec as libflate::deflate::symbol::HuffmanCodec>::save::hdd89f73911df40f8
17: 0x55ae8d481a55 - libflate::deflate::encode::BlockBuf<E>::flush::hdb9aca267ba7abb0
18: 0x55ae8d480739 - <libflate::gzip::Encoder<W,E> as std::io::Write>::write::hb6a875277191af9d
19: 0x55ae8d47e90a - std::io::Write::write_all::hb1f18e7c5ffbbf6a
20: 0x55ae8d4d0f89 - std::io::copy::stack_buffer_copy::hec17b6e4aad8ac9f
21: 0x55ae8d4ccf24 - tar::builder::append_fs::h82679d7959de76b6
22: 0x55ae8d4cc59b - tar::builder::append_file::hac6cb522d857b573
23: 0x55ae8d46ed48 - cargo_bundle::bundle::deb_bundle::tar_and_gzip_dir::hcb76cf24a57ccc57
24: 0x55ae8d46c4ee - cargo_bundle::bundle::deb_bundle::bundle_project::h202760933c6ef2f9
25: 0x55ae8d48fa4d - cargo_bundle::bundle::bundle_project::h0784e8854d62e106
26: 0x55ae8d453592 - cargo_bundle::main::hd0d203f49751d720
27: 0x55ae8d458773 - std::sys_common::backtrace::__rust_begin_short_backtrace::h21fe51264a508309
28: 0x55ae8d458aa9 - std::rt::lang_start::{{closure}}::h7f75396b90d75f65
29: 0x55ae8d646dae - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hb1327dc2ef3fecdf
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/ops/function.rs:287:13
30: 0x55ae8d646dae - std::panicking::try::do_call::h4044173225fe83dd
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40
31: 0x55ae8d646dae - std::panicking::try::hd8a722c09d156a53
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19
32: 0x55ae8d646dae - std::panic::catch_unwind::hd2ca07971cf0119b
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14
33: 0x55ae8d646dae - std::rt::lang_start_internal::{{closure}}::h26d89d595cf47b70
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:148:48
34: 0x55ae8d646dae - std::panicking::try::do_call::hf47aa1aa005e5f1a
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:485:40
35: 0x55ae8d646dae - std::panicking::try::h73d246b2423eaf4e
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:449:19
36: 0x55ae8d646dae - std::panic::catch_unwind::hbaaeae8f1b2f9915
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panic.rs:140:14
37: 0x55ae8d646dae - std::rt::lang_start_internal::h76f3e81e6b8f13f9
at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/rt.rs:148:20
38: 0x55ae8d457c65 - main
39: 0x7ff2c5fc324e - __libc_start_call_main
40: 0x7ff2c5fc3309 - __libc_start_main_alias_1
41: 0x55ae8d42eb05 - _start
42: 0x0 - <unknown>
I tried updating libflate to 1.4 and then ran cargo install cargo-bundle --path /work/cargo-bundle
but now it crashes with error: No [package.metadata.bundle] section in Cargo.toml
. Which is odd, because I definitely have [package.metadata.bundle]
. If I didn't, the original cargo-bundle wouldn't have got far enough to get the crash I originally reported.
We're using workspaces, if that makes a difference.
There are definitely known issues with how cargo-bundle currently interacts with workspaces. Any PRs to improve this situation would be very welcome.
Can confirm, i have the exact same error message:
thread 'main' panicked at /home/biochemic/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libflate-0.1.27/src/huffman.rs:217:19:
index out of bounds: the len is 15 but the index is 15
However i'm not using workspaces, but use [[bin]]
instead
i'm trying to bundle my app with cargo bundle --bin xyz
and cargo bundle --bin xyz --release
Curiously, the very first time i used cargo bundle ...
it worked and i was able to get a .deb file out on my system.
Relevant System info:
os: "Linux 22.04 Ubuntu", kernel: "6.4.0-060400-generic"
now the weird part is, i mentioned that it worked the first time.
I just did again, with a custom profile. I have an optimized release profile, that appears to be bundling fine.
That's the profile config i have in the Cargo.toml
:
[profile.release-opt]
inherits = "release"
codegen-units = 1
debug = false
lto = "fat"
incremental = false
opt-level = 3
overflow-checks = false
strip = "debuginfo"
panic = "abort"