Skip to content
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

Redirecting output with --check to pager causes compiler panic on early exit #6089

Open
Sindisil opened this issue Feb 23, 2024 · 1 comment

Comments

@Sindisil
Copy link
Contributor

When I redirect --check output to a pager, I get a compiler panic when I exit the pager (e.g., using the 'q' command in either more or less). If I use more rather than less, and page through the entire output until the pager exits naturally, I get no panic.

My example is asking for no color, but the panic occurs without that.

I'm seeing this in gnome-terminal on a vanilla Fedora 39 box.

Panic output follows

sindisil@barad-dur:~/Projects/lned$ cargo fmt --check -- --color never | less
thread 'main' panicked at library/std/src/io/stdio.rs:1030:9:
failed printing to stdout: Broken pipe (os error 32)
stack backtrace:
0: 0x7f01e833ad16 - std::backtrace_rs::backtrace::libunwind::trace::h10897894958cd49e
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7f01e833ad16 - std::backtrace_rs::backtrace::trace_unsynchronized::h44034e8a12f002c2
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f01e833ad16 - std::sys_common::backtrace::_print_fmt::hf3aee16d36b99950
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/sys_common/backtrace.rs:68:5
3: 0x7f01e833ad16 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h4cc0196933b2d33b
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f01e838d770 - core::fmt::rt::Argument::fmt::hb7b6f634f32478df
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/core/src/fmt/rt.rs:142:9
5: 0x7f01e838d770 - core::fmt::write::h71a912a0876ff953
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/core/src/fmt/mod.rs:1120:17
6: 0x7f01e832e61f - std::io::Write::write_fmt::hd0e967738786a93f
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/io/mod.rs:1846:15
7: 0x7f01e833aaf4 - std::sys_common::backtrace::_print::hb4bc24c6a39e5a17
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f01e833aaf4 - std::sys_common::backtrace::print::h33f3fe08a229dca2
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f01e833d887 - std::panicking::default_hook::{{closure}}::h862a191a664c6dc5
10: 0x7f01e833d5e9 - std::panicking::default_hook::hc92b5312272280af
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:292:9
11: 0x7f01e51aa4fc - std[8b2722c11524b2b8]::panicking::update_hook::<alloc[779e24b66daba78d]::boxed::Box<rustc_driver_impl[ea9433488708d8a7]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7f01e833dfd6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call::hc4fc7af48e2c3887
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/alloc/src/boxed.rs:2029:9
13: 0x7f01e833dfd6 - std::panicking::rust_panic_with_hook::had7afe3bd886e7d6
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:785:13
14: 0x7f01e833dd22 - std::panicking::begin_panic_handler::{{closure}}::had698405d69ce54e
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:659:13
15: 0x7f01e833b216 - std::sys_common::backtrace::__rust_end_short_backtrace::hb2ede901b4663678
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/sys_common/backtrace.rs:171:18
16: 0x7f01e833da74 - rust_begin_unwind
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:647:5
17: 0x7f01e8389e75 - core::panicking::panic_fmt::hab1e6de73e71f54d
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/core/src/panicking.rs:72:14
18: 0x7f01e832cd48 - std::io::stdio::print_to::h1c464b61f88b65fe
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/io/stdio.rs:1030:9
19: 0x7f01e832cd48 - std::io::stdio::_print::h83f167e61aa593de
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/io/stdio.rs:1106:5
20: 0x55e28be0b7c8 - <rustfmt_nightly[194ae070ff7584cb]::rustfmt_diff::OutputWriter>::writeln
21: 0x55e28bd9d785 - <rustfmt_nightly[194ae070ff7584cb]::emitter::diff::DiffEmitter as rustfmt_nightly[194ae070ff7584cb]::emitter::Emitter>::emit_formatted_file
22: 0x55e28bc983f9 - <rustfmt_nightly[194ae070ff7584cb]::Session<std[8b2722c11524b2b8]::io::stdio::Stdout>>::format_input_inner::{closure#0}
23: 0x55e28bcac737 - rustfmt[9bfbb3a37f21832]::format_and_emit_report::<std[8b2722c11524b2b8]::io::stdio::Stdout>
24: 0x55e28bcab01e - rustfmt[9bfbb3a37f21832]::execute
25: 0x55e28bca6826 - rustfmt[9bfbb3a37f21832]::main
26: 0x55e28bc91b03 - std[8b2722c11524b2b8]::sys_common::backtrace::__rust_begin_short_backtrace::<fn(), ()>
27: 0x55e28bc93d19 - std[8b2722c11524b2b8]::rt::lang_start::<()>::{closure#0}
28: 0x7f01e831e911 - core::ops::function::impls::<impl core::ops::function::FnOnce for &F>::call_once::h670d35ebe949a3cf
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/core/src/ops/function.rs:284:13
29: 0x7f01e831e911 - std::panicking::try::do_call::h41db3b277bd57798
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:554:40
30: 0x7f01e831e911 - std::panicking::try::hb70956d01a381fdd
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:518:19
31: 0x7f01e831e911 - std::panic::catch_unwind::hd1eaf75e3aeaaef8
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panic.rs:142:14
32: 0x7f01e831e911 - std::rt::lang_start_internal::{{closure}}::h9671d32e4cdfebd5
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/rt.rs:148:48
33: 0x7f01e831e911 - std::panicking::try::do_call::ha046eb9e51bbf147
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:554:40
34: 0x7f01e831e911 - std::panicking::try::hda56b5674ac03b0a
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panicking.rs:518:19
35: 0x7f01e831e911 - std::panic::catch_unwind::h431342979dbf3d57
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/panic.rs:142:14
36: 0x7f01e831e911 - std::rt::lang_start_internal::he4de2f11a3fa977e
at /rustc/f2043422f7b161a2fc1a00589a8c4956db963450/library/std/src/rt.rs:148:20
37: 0x55e28bcad965 - main
38: 0x7f01e244614a - __libc_start_call_main
39: 0x7f01e244620b - __libc_start_main_impl
40: 0x55e28bc80679 -
41: 0x0 -

error: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rustfmt/issues/new?labels=bug

note: rustc 1.77.0-beta.5 (f2043422f 2024-02-17) running on x86_64-unknown-linux-gnu

query stack during panic:
end of query stack
sindisil@barad-dur:~/Projects/lned$

@ytmimi
Copy link
Contributor

ytmimi commented Feb 26, 2024

Thanks for the report! This seems like it's related to #2926. Might even be a duplicate.

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

No branches or pull requests

2 participants