withoutboats / notty

A new kind of terminal
GNU Affero General Public License v3.0
2.31k stars 41 forks source link

Running `TERM=xterm vi` crashes scaffolding terminal #57

Closed zielmicha closed 7 years ago

zielmicha commented 7 years ago

I wanted to see how compatible is notty with xterm. I understand that it might not work, but probably shouldn't crash notty. I use Ubuntu 16.04. RUST_BACKTRACE=1 ./target/debug/scaffolding-terminal

stack backtrace:
   1:     0x5567a3415eac - std::sys::imp::backtrace::tracing::imp::write::h9c41d2f69e5caabf
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:42
   2:     0x5567a3418bae - std::panicking::default_hook::{{closure}}::h1f61f3c769fffe7a
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:351
   3:     0x5567a34187b4 - std::panicking::default_hook::hd5bda4e453dfb4be
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:367
   4:     0x5567a341904b - std::panicking::rust_panic_with_hook::hffbc74969c7b5d87
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:555
   5:     0x5567a3418ee4 - std::panicking::begin_panic::h3bbdbb2a23440035
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:517
   6:     0x5567a3418e09 - std::panicking::begin_panic_fmt::h34f5b320b0f94559
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:501
   7:     0x5567a3418d97 - rust_begin_unwind
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:477
   8:     0x5567a344121d - core::panicking::panic_fmt::h1016b85b51d1931f
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/panicking.rs:69
   9:     0x5567a32d3583 - core::result::unwrap_failed::h8e1322835f67bad8
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/macros.rs:29
  10:     0x5567a32c5734 - <core::result::Result<T, E>>::unwrap::h490137277e8cf964
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libcore/result.rs:745
  11:     0x5567a32b99e8 - <notty::output::Output<R>>::csi_code::haf11f6348d6b03e0
                        at /home/michal/misc/notty/src/output/mod.rs:136
  12:     0x5567a32ec4e7 - <notty::output::Output<R> as core::iter::iterator::Iterator>::next::hec2ad9aae17cc842
                        at /home/michal/misc/notty/src/output/mod.rs:258
  13:     0x5567a32f76c1 - scaffolding_terminal::main::{{closure}}::h365f32399a302701
                        at /home/michal/misc/notty/scaffolding/src/main.rs:80
  14:     0x5567a32f12c1 - <std::panic::AssertUnwindSafe<F> as core::ops::FnOnce<()>>::call_once::hbd20d33fdc386e6b
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panic.rs:296
  15:     0x5567a32c02b1 - std::panicking::try::do_call::h9ed515c166360879
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:460
  16:     0x5567a341ff1a - __rust_maybe_catch_panic
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libpanic_unwind/lib.rs:98
  17:     0x5567a32bffbb - std::panicking::try::h7b55dadf400a88ba
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panicking.rs:436
  18:     0x5567a32bf061 - std::panic::catch_unwind::h68fe3a79110fe04a
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/panic.rs:361
  19:     0x5567a32bfc44 - std::thread::Builder::spawn::{{closure}}::haf0b8bbea4de2314
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/thread/mod.rs:357
  20:     0x5567a32d79f3 - <F as alloc::boxed::FnBox<A>>::call_box::h9d58fbb764766bfa
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/liballoc/boxed.rs:605
  21:     0x5567a3418004 - std::sys::imp::thread::Thread::new::thread_start::h76badbf9b0ecaf58
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/liballoc/boxed.rs:615
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys_common/thread.rs:21
                        at /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/libstd/sys/unix/thread.rs:84
  22:     0x7f1e755af6f9 - start_thread
  23:     0x7f1e750cfb5c - clone
  24:                0x0 - <unknown>
withoutboats commented 7 years ago

This is a known difference. There is a specific feature (margins) that xterm supports that notty doesn't, which vi will use if its supported. notty does not support that feature because I couldn't understand from the xterm and VT docs how it actually should behave.

That's why notty comes with its own terminfo sheet, which is xterm-256color with that command removed. vi should at least not crash with the correct terminfo sheet.