Summary
With two or more hooks with the same priority set, if one hook has a long name and matches no files, and the other hook fails or modifies files, prek overflows when formatting output:
Deoptimize tests........................................................................Passed
Files were modified by following hooks..................................................Failed
┌ Remove eval comments................................................................Passed
thread 'main' (212100499) panicked at library/alloc/src/raw_vec/mod.rs:28:5:
capacity overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' (212100499) panicked at /nix/var/nix/b/16c95sqa4m24imdgg9acaa6sj0/prek-0.3.0-vendor/indicatif-0.18.3/src/draw_target.rs:190:43:
called `Result::unwrap()` on an `Err` value: PoisonError { .. }
stack backtrace:
0: 0x104a998fc - <std::sys::backtrace::BacktraceLock::print::DisplayBacktrace as core::fmt::Display>::fmt::h8c5ab870ebd4c242
1: 0x104aa9794 - core::fmt::write::h64810b21425781ec
2: 0x104a6dc0c - std::io::Write::write_fmt::h947344a43c638468
3: 0x104a7d28c - std::panicking::default_hook::{{closure}}::ha0993a93f6e4994d
4: 0x104a7d18c - std::panicking::default_hook::h7aae5c8c53b8a669
5: 0x104a7d684 - std::panicking::panic_with_hook::hb885411bb59bebf4
6: 0x104a7d338 - std::panicking::panic_handler::{{closure}}::hb04320f9e43192c5
7: 0x104a78c94 - std::sys::backtrace::__rust_end_short_backtrace::ha3c55a1c4767eecf
8: 0x104a659a4 - __rustc[d131491b17107b07]::rust_begin_unwind
9: 0x104ae9044 - core::panicking::panic_fmt::h6f8816b337451651
10: 0x104ae8d8c - core::result::unwrap_failed::h1f9c817951eee5c5
11: 0x1048c0a44 - indicatif::draw_target::ProgressDrawTarget::drawable::h6f07f46e3330c5cb
12: 0x1048bfb4c - indicatif::state::BarState::draw::ha2f98c076744e472
13: 0x1048bf534 - indicatif::state::BarState::finish_using_style::hce1ec509d844fb94
14: 0x1048beeec - <indicatif::state::BarState as core::ops::drop::Drop>::drop::heb5d2fb779985c11
15: 0x1048c4cf4 - core::ptr::drop_in_place<core::cell::UnsafeCell<indicatif::state::BarState>>::hb570e6a81cb1e72a
16: 0x1048c4ee0 - alloc::sync::Arc<T,A>::drop_slow::h082716d5bab5e20f
17: 0x10455cb00 - alloc::sync::Arc<T,A>::drop_slow::h3065a8ff8d677f16
18: 0x1044e1ae0 - prek::cli::run::run::run::{{closure}}::hf18b4785dc9954d2
19: 0x1044f3b4c - prek::run::{{closure}}::h3c658c1f6c808be6
20: 0x1045a0020 - tokio::runtime::scheduler::current_thread::Context::enter::h815d2d1e6df56635
21: 0x1045411e4 - tokio::runtime::context::scoped::Scoped<T>::set::h48ed938b8286f7e9
22: 0x1045a01f8 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::haae80b832dd3dabc
23: 0x104541568 - tokio::runtime::context::runtime::enter_runtime::h08ec1a511daff97d
24: 0x104598780 - prek::main::hf5203521045bc841
25: 0x10447f618 - std::sys::backtrace::__rust_begin_short_backtrace::hcca8770e4962ab23
26: 0x10456557c - std::rt::lang_start::{{closure}}::h3b6ed105c312d516
27: 0x104a6f3f8 - std::rt::lang_start_internal::h0662b076b027b010
28: 0x1045bed40 - _main
thread 'main' (212100499) panicked at library/core/src/panicking.rs:233:5:
panic in a destructor during cleanup
thread caused non-unwinding panic. aborting.
error: .git/hooks/pre-commit died of signal 6
Willing to submit a PR?
Platform
macOS 15.7.3 (24G419)
Version
prek 0.3.0
.pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: long-name
name: This very long name causes an overflow when formatting the output
entry: 'echo'
language: system
files: '^$' # Don't match any files
priority: 1
- id: always-fail
name: this hook always modifies a file and fails
entry: |
sh -c 'echo "I have changed a file" >> README.md && false'
language: system
priority: 1
Log file
N/A
Summary
With two or more hooks with the same
priorityset, if one hook has a long name and matches no files, and the other hook fails or modifies files,prekoverflows when formatting output:Willing to submit a PR?
Platform
macOS 15.7.3 (24G419)
Version
prek 0.3.0
.pre-commit-config.yaml
Log file
N/A