atuinsh/atuin

[Bug]: panic/crash when executing on i686 system

ajkessel opened this issue · 3 comments

What did you expect to happen?

I was able to build atuin from source on an i686 system (rustc 1.81.0-beta.6 (b5fd9f6f1 2024-08-21)), but I get a crash as soon as it's invoked:

hread 'main' panicked at crates/atuin/src/command/client/search/interactive.rs:537:41:
attempt to subtract with overflow
stack backtrace:
   0: 0x58d08281 - std::backtrace_rs::backtrace::libunwind::trace::h97bc3353441b01aa
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/../../backtrace/src/backtrace/libunwind.rs:116:5
   1: 0x58d08281 - std::backtrace_rs::backtrace::trace_unsynchronized::h02bcfc49ff87cdab
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: 0x58d08281 - std::sys_common::backtrace::_print_fmt::ha7ed84ccc6ed8972
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:68:5
   3: 0x58d08281 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he088940675b0a773
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:44:22
   4: 0x58d358f6 - core::fmt::rt::Argument::fmt::hf75a56d7c9a72cd5
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/rt.rs:165:63
   5: 0x58d358f6 - core::fmt::write::hc9004f6f28802b9e
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/fmt/mod.rs:1168:21
   6: 0x58d03d56 - std::io::Write::write_fmt::h6a5f96a8bdb77617
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/io/mod.rs:1835:15
   7: 0x58d08079 - std::sys_common::backtrace::_print::hb2ddbb7d2fb0b015
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:47:5
   8: 0x58d08079 - std::sys_common::backtrace::print::hce4ab07329d0ec63
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:34:9
   9: 0x58d0950c - std::panicking::default_hook::{{closure}}::h7655780670af7515
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:271:22
  10: 0x58d09264 - std::panicking::default_hook::h177c8cc1455e1406
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:298:9
  11: 0x58d09a99 - std::panicking::rust_panic_with_hook::h32cfe3279d3bd04f
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:795:13
  12: 0x58d0994a - std::panicking::begin_panic_handler::{{closure}}::h2002564ae5482ad9
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:656:13
  13: 0x58d08746 - std::sys_common::backtrace::__rust_end_short_backtrace::hb8fa90ed18c03223
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:171:18
  14: 0x58d096af - rust_begin_unwind
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:652:5
  15: 0x56623330 - core::panicking::panic_fmt::h2a5e6a51db403357
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:72:14
  16: 0x56623c58 - core::panicking::panic_const::panic_const_sub_overflow::h601362936211ffb3
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/panicking.rs:179:21
  17: 0x56819935 - atuin::command::client::search::interactive::State::scroll_up::hf59339854cafa07f
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:537:41
  18: 0x5681841c - atuin::command::client::search::interactive::State::handle_search_scroll_one_line::h6fa028b1314e163e
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:265:13
  19: 0x568184f1 - atuin::command::client::search::interactive::State::handle_search_up::h91d8a55c59d292e0
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:271:9
  20: 0x56818ba1 - atuin::command::client::search::interactive::State::handle_search_input::hed34c253ac3235a0
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:494:24
  21: 0x5681834d - atuin::command::client::search::interactive::State::handle_key_input::ha8e453fabfbe47f5
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:241:18
  22: 0x56b1d4dc - atuin::command::client::search::interactive::State::handle_input::h790d71e1484e994d
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:119:30
  23: 0x56b2001d - atuin::command::client::search::interactive::history::{{closure}}::hd37c3836818c499b
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search/interactive.rs:1100:31
  24: 0x56b66cb6 - atuin::command::client::search::Cmd::run::{{closure}}::h311ceaee63cce65a
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client/search.rs:201:90
  25: 0x56c6fe85 - atuin::command::client::Cmd::run_inner::{{closure}}::ha76083cdbb807fa5
                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client.rs:143:88
  26: 0x56aee337 - <core::pin::Pin<P> as core::future::future::Future>::poll::h28500e3d3d74d7d4
                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/future/future.rs:123:9
  27: 0x5662b25f - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::{{closure}}::h9d42463bf352b671
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:659:57
  28: 0x5662b160 - tokio::runtime::coop::with_budget::h9dc269579b68a8fb
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/coop.rs:107:5
  29: 0x5662b160 - tokio::runtime::coop::budget::he951c72f4c354a17
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/coop.rs:73:5
  30: 0x5662b160 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::{{closure}}::h514e386cba3d5114
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:659:25
  31: 0x5662863a - tokio::runtime::scheduler::current_thread::Context::enter::h3786fd0ed90ab9e6
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:404:19
  32: 0x5662a7b4 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::{{closure}}::h77894e320ced1cc1
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:658:36
  33: 0x56629b5b - tokio::runtime::scheduler::current_thread::CoreGuard::enter::{{closure}}::hb04d5d93e82abd36
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:737:68
  34: 0x56a85d00 - tokio::runtime::context::scoped::Scoped<T>::set::hb4bc4414b269ab90
                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/context/scoped.rs:40:9
  35: 0x566cf0f6 - tokio::runtime::context::set_scheduler::{{closure}}::h2cc0ebba4d169c80                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/context.rs:180:26  36: 0x56c33df5 - std::thread::local::LocalKey<T>::try_with::h258406266eb350b4                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/local.rs:283:12  37: 0x56c3333b - std::thread::local::LocalKey<T>::with::hef1c415240721df5                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/thread/local.rs:260:9  38: 0x566cf084 - tokio::runtime::context::set_scheduler::hcdda4d95c3d0df3d                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/context.rs:180:9  39: 0x5662946f - tokio::runtime::scheduler::current_thread::CoreGuard::enter::h400573c74e54e4aa                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:737:27  40: 0x56629c30 - tokio::runtime::scheduler::current_thread::CoreGuard::block_on::h336ea3f16cf3777d                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:646:19  41: 0x566247df - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::{{closure}}::ha64d083c0ce2a547                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:175:28  42: 0x56ac0d05 - tokio::runtime::context::runtime::enter_runtime::h27f60765a0cec788                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/context/runtime.rs:65:16  43: 0x56624192 - tokio::runtime::scheduler::current_thread::CurrentThread::block_on::h7ed4aa42c2ab58e2                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/scheduler/current_thread/mod.rs:167:9  44: 0x56c274e9 - tokio::runtime::runtime::Runtime::block_on::h0096b7d0b36fbea2                       at /home/adam/.cargo/registry/src/index.crates.io-1cd66030c949c28d/tokio-1.38.0/src/runtime/runtime.rs:347:47  45: 0x5663127f - atuin::command::client::Cmd::run::h6c3d6e2f29ef3f7a                       at /backups/home/adam/src/atuin/crates/atuin/src/command/client.rs:100:19  46: 0x56938096 - atuin::command::AtuinCmd::run::hcfe73722f60f20b8                       at /backups/home/adam/src/atuin/crates/atuin/src/command/mod.rs:50:37  47: 0x56827ce6 - atuin::Atuin::run::hb32e435d18ad53ad                       at /backups/home/adam/src/atuin/crates/atuin/src/main.rs:41:9  48: 0x56827d26 - atuin::main::h9c446994a855ae3a                       at /backups/home/adam/src/atuin/crates/atuin/src/main.rs:46:5  49: 0x56943006 - core::ops::function::FnOnce::call_once::hc7937a00916fd85d                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:250:5  50: 0x566a8e3c - std::sys_common::backtrace::__rust_begin_short_backtrace::h37418903795cea04                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/sys_common/backtrace.rs:155:18  51: 0x56b93942 - std::rt::lang_start::{{closure}}::hbdd3958d966418b6                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/rt.rs:159:18  52: 0x58cf97e4 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h980f32a74e75f7ae                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/core/src/ops/function.rs:284:13  53: 0x58cf97e4 - std::panicking::try::do_call::h9eba7926818b46a4                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40  54: 0x58cf97e4 - std::panicking::try::h579440b9edc34b1b                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19  55: 0x58cf97e4 - std::panic::catch_unwind::hd14a6ef4f5115f13                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14  56: 0x58cf97e4 - std::rt::lang_start_internal::{{closure}}::h769057aa4245076a                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/rt.rs:141:48  57: 0x58cf97e4 - std::panicking::try::do_call::hc784f2fd668eb69c                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:559:40  58: 0x58cf97e4 - std::panicking::try::h6d3601b218d02da9                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panicking.rs:523:19  59: 0x58cf97e4 - std::panic::catch_unwind::hf41c72f21e1a94b4                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/panic.rs:149:14  60: 0x58cf97e4 - std::rt::lang_start_internal::h36bcdf4b524ca783                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/rt.rs:141:20  61: 0x56b9390b - std::rt::lang_start::hed710a4575f753a7                       at /rustc/3f5fd8dd41153bc5fdca9427e9e05be2c767ba23/library/std/src/rt.rs:158:17  62: 0x56828201 - main  63: 0xf7bdf2d5 - <unknown>  64: 0xf7bdf398 - __libc_start_main  65: 0x56623fa7 - _start  66:        0x0 - <unknown> 

What happened?

Run without crash

Atuin doctor output

Atuin Doctor
Checking for diagnostics

[Shell] If you are using Bash, Atuin requires that either bash-preexec or ble.sh be installed. An older ble.sh may not be detected. so ignore this if you have it set up! Read more here: https://docs.atuin.sh/guide/installation/#bash

Please include the output below with any bug reports or issues

{
  "atuin": {
    "version": "18.4.0-beta.3",
    "sync": {
      "cloud": false,
      "records": true,
      "auto_sync": true,
      "last_sync": "1970-01-01 0:00:00.0 +00:00:00"
    },
    "sqlite_version": "3.45.0"
  },
  "shell": {
    "name": "bash",
    "default": "bash",
    "plugins": [
      "atuin"
    ],
    "preexec": "none"
  },
  "system": {
    "os": "Debian GNU/Linux",
    "arch": "x86_64",
    "version": "12",
    "disks": [
      {
        "name": "/dev/root",
        "filesystem": "ext3"
      },
      {
        "name": "/dev/xvda2",
        "filesystem": "ext4"
      }
    ]
  }
}


### Code of Conduct

- [X] I agree to follow this project's Code of Conduct

Hey! Thanks for the issue

Do you get the same issue building with 1.80? Using https://rustup.rs/ and building from source should select the correct version automatically

OK, that seems to work. Thanks! You may have seen my other issue about failing to build with an older rust, too.

Glad it's sorted!