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

Crash on login to Reddit via token bearer flow #111

Open
dotancohen opened this issue Feb 16, 2025 · 2 comments
Open

Crash on login to Reddit via token bearer flow #111

dotancohen opened this issue Feb 16, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@dotancohen
Copy link

Bug description

$ export RUST_BACKTRACE=1; rexit messages -t
> Your Bearer Token from Matrix; https://github.com/mpult/rexit/ under Important Notice ********
2025-02-16 12:30 - INFO: Login Successful
2025-02-16 12:30 - INFO: Initializing Image Log
thread 'main' panicked at src/ReAPI/rooms.rs:58:10:
Error parsing array; likely error with login
stack backtrace:
   0: rust_begin_unwind
             at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_display
             at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/panicking.rs:178:5
   3: core::panicking::panic_str
             at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/panicking.rs:152:5
   4: core::option::expect_failed
             at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/option.rs:1985:5
   5: rexit::ReAPI::rooms::download_rooms::{{closure}}
   6: rexit::main::{{closure}}
   7: tokio::runtime::park::CachedParkThread::block_on
   8: tokio::runtime::context::runtime::enter_runtime
   9: tokio::runtime::runtime::Runtime::block_on
  10: rexit::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
  • I'll add the full backtrace to the first comment, to not pollute this bug report.

  • Would you like to work on a fix? [y/n]

No, I do not have the technical capabilities to work on a fix. But if someone wants to mentor me through it, and be patient while I learn Rust along the way, I'm happy to oblige.

To Reproduce

Steps to reproduce the behavior:

  1. Install Rexit via cargo | Build Rexit from the Main branch (I tried both)
  2. Run rexit messages -t
  3. Paste proper, working Authorization header, not including the word "Bearer".
  4. ...
  5. Profit

I am able to reproduce the bug in the main branch, too. That's the backtrace that I'll add to the first comment.

Environment

$ cat /etc/issue
Ubuntu 24.04.1 LTS \n \l

$ ./target/release/rexit -V
rexit 2.0.0
@dotancohen dotancohen added the bug Something isn't working label Feb 16, 2025
@dotancohen
Copy link
Author

Full backtrace:

$ export RUST_BACKTRACE=full; ./target/release/rexit messages -t
> Your Bearer Token from Matrix; https://github.com/mpult/rexit/ under Important Notice ********
2025-02-16 12:31 - INFO: Login Successful
2025-02-16 12:31 - INFO: Initializing Image Log
thread 'main' panicked at src/ReAPI/rooms.rs:58:10:
Error parsing array; likely error with login
stack backtrace:
   0:     0x5ef669d1f9eb - std::backtrace_rs::backtrace::libunwind::trace::he991e66e5f22a1db
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x5ef669d1f9eb - std::backtrace_rs::backtrace::trace_unsynchronized::h43f35a5576eecb13
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5ef669d1f9eb - std::sys_common::backtrace::_print_fmt::hf9c799a68b2477fc
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x5ef669d1f9eb - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf2d48dfeb5948660
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x5ef669d612d0 - core::fmt::rt::Argument::fmt::h507ca91fbb1ef494
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/fmt/rt.rs:142:9
   5:     0x5ef669d612d0 - core::fmt::write::h4d5f6025aa566322
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/fmt/mod.rs:1120:17
   6:     0x5ef669d12a9d - std::io::Write::write_fmt::hc088b3c8cc6dcb9f
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/io/mod.rs:1762:15
   7:     0x5ef669d1f7d4 - std::sys_common::backtrace::_print::h231201f6cff8f56a
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x5ef669d1f7d4 - std::sys_common::backtrace::print::h478d6be486f8cd2d
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x5ef669d4646a - std::panicking::default_hook::{{closure}}::hf1c55106b4d45a90
  10:     0x5ef669d4610d - std::panicking::default_hook::h7b29000c631cc719
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:292:9
  11:     0x5ef669d46888 - std::panicking::rust_panic_with_hook::h2a988919dd121561
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:779:13
  12:     0x5ef669d1fdce - std::panicking::begin_panic_handler::{{closure}}::h3a9eaa1d23ecf555
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:657:13
  13:     0x5ef669d1fc06 - std::sys_common::backtrace::__rust_end_short_backtrace::h813561fdec15f700
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x5ef669d465b2 - rust_begin_unwind
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:645:5
  15:     0x5ef66999da45 - core::panicking::panic_fmt::hef0307862026e6f9
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/panicking.rs:72:14
  16:     0x5ef66999e163 - core::panicking::panic_display::hed86ea0466f0a3dc
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/panicking.rs:178:5
  17:     0x5ef66999e163 - core::panicking::panic_str::h1dc008f642ffb82c
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/panicking.rs:152:5
  18:     0x5ef66999e163 - core::option::expect_failed::hd0fb791ee88ae8a9
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/option.rs:1985:5
  19:     0x5ef6699aa69b - rexit::ReAPI::rooms::download_rooms::{{closure}}::h585a9246ba9d9f6a
  20:     0x5ef6699afc52 - rexit::main::{{closure}}::h67324918bfa8c1d7
  21:     0x5ef6699a46a9 - tokio::runtime::park::CachedParkThread::block_on::h3de7d07f8020a4b1
  22:     0x5ef6699fa669 - tokio::runtime::context::runtime::enter_runtime::h017ef1660d567986
  23:     0x5ef669a1c7bc - tokio::runtime::runtime::Runtime::block_on::hd63aa9fb2aa1b05b
  24:     0x5ef669a022f8 - rexit::main::h86b0effff57bd36e
  25:     0x5ef669a193b3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6a22acd0e651be3d
  26:     0x5ef669a23f79 - std::rt::lang_start::{{closure}}::h756c4cba4c452ea4
  27:     0x5ef669d464a4 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h2a98286140a8c485
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/core/src/ops/function.rs:284:13
  28:     0x5ef669d464a4 - std::panicking::try::do_call::h6f884a82d660d639
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:552:40
  29:     0x5ef669d464a4 - std::panicking::try::h3d219ee83761ccf8
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:516:19
  30:     0x5ef669d464a4 - std::panic::catch_unwind::h0a8f78f1f5633cdb
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panic.rs:142:14
  31:     0x5ef669d464a4 - std::rt::lang_start_internal::{{closure}}::hd36869a5192571c4
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/rt.rs:148:48
  32:     0x5ef669d464a4 - std::panicking::try::do_call::hbfe6916f1cc74e35
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:552:40
  33:     0x5ef669d464a4 - std::panicking::try::h0cc643a8ace88736
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panicking.rs:516:19
  34:     0x5ef669d2df4b - std::panic::catch_unwind::hd66d6c526b1a6302
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/panic.rs:142:14
  35:     0x5ef669d2df4b - std::rt::lang_start_internal::h8fc8e9636333b06e
                               at /build/rustc-ntAYxy/rustc-1.75.0+dfsg0ubuntu1/library/std/src/rt.rs:148:20
  36:     0x5ef669a23f6e - std::rt::lang_start::hec1ac5526a26bc1b
  37:     0x72352202a1ca - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  38:     0x72352202a28b - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  39:     0x5ef66999e3b5 - _start
  40:                0x0 - <unknown>

@sophie-code-lock
Copy link

Hey, long time listener, first time caller. I have zero experience with Rust, and I usually use MacOS. But I was experiencing a similar issue, and I fixed it.

The gottcha for me was this: it turns out, (in powershell at least) if you try to use Ctrl-V to paste into stdin, the only input will be V rather than the clipboard contents. Rexit still says 'Login Successful', but that's not actually an indicator of success.

I used cURL with the bearer token, and to my surprise, got a valid response. So I ended up building it from source and hardcoding the token (even though I figured out later in powershell I could just right click). And everything worked!

I would suggest using cURL or whatever to check the token is valid. Good luck, I hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants