crash on nix repl --file #184

Closed
opened 2024-03-25 18:11:46 +00:00 by janik · 10 comments
Member

Describe the bug

when executing exactly:

nix repl --file 

nix just crashes and outputs:

The application panicked (crashed).
Message:  index out of bounds: the len is 2 but the index is 2
Location: src/nix.rs:128

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Expected behavior

Handle that case more gracefully and have a nice error message telling the user they forgot to specify a file similar to what nix repl non-existnet-file.nix would produce.

nix-env --version output

nix-env (Nix) 2.90.0-lix

## Describe the bug when executing exactly: ```bash nix repl --file ``` nix just crashes and outputs: ``` The application panicked (crashed). Message: index out of bounds: the len is 2 but the index is 2 Location: src/nix.rs:128 Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it. Run with RUST_BACKTRACE=full to include source snippets. ``` ## Expected behavior Handle that case more gracefully and have a nice error message telling the user they forgot to specify a file similar to what `nix repl non-existnet-file.nix` would produce. ## `nix-env --version` output nix-env (Nix) 2.90.0-lix
janik added the
bug
label 2024-03-25 18:11:46 +00:00
Owner

What on earth. You don't get error: flag '--file' requires 1 argument(s), but only 0 were given? Why is Rust in there? This is wild. Do you have @jade 's external nix-doc plugin loaded maybe?

What on earth. You don't get `error: flag '--file' requires 1 argument(s), but only 0 were given`? Why is Rust in there? This is wild. Do you have @jade 's external nix-doc plugin loaded maybe?
Author
Member

Nope no repl plugins loaded :drgn:

Nope no repl plugins loaded :drgn:
Author
Member

image

![image](/attachments/4257dc59-6545-4d36-ae94-2bdb0b009e57)
Owner

Could you run with RUST_BACKTRACE=1 and post the result?

Could you run with `RUST_BACKTRACE=1` and post the result?
Author
Member

Of course:

The application panicked (crashed).
Message:  index out of bounds: the len is 2 but the index is 2
Location: src/nix.rs:128

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 7 frames hidden ⋮
   8: core::panicking::panic_bounds_check::h927eee4b8cc0749f
      at <unknown source file>:<unknown line>
   9: nix_your_shell::nix::transform_nix::hcca3fcc3ee263aeb
      at <unknown source file>:<unknown line>
  10: nix_your_shell::main::he77c85bcd3feab97
      at <unknown source file>:<unknown line>
  11: std::sys_common::backtrace::__rust_begin_short_backtrace::hf75262ecf6c0fa18
      at <unknown source file>:<unknown line>
  12: std::rt::lang_start::{{closure}}::h8cc63ff27203ca52
      at <unknown source file>:<unknown line>
  13: std::panicking::try::h45c8379f4866ecc7
      at <unknown source file>:<unknown line>
  14: std::rt::lang_start_internal::hf358ddc7f05da9a0
      at <unknown source file>:<unknown line>
  15: main<unknown>
      at <unknown source file>:<unknown line>
  16: __libc_start_call_main<unknown>
      at <unknown source file>:<unknown line>
  17: __libc_start_main@GLIBC_2.2.5<unknown>
      at <unknown source file>:<unknown line>
  18: _start<unknown>
      at <unknown source file>:<unknown line>

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.

(sorry should have done that when opening the issue 🙈)

Of course: ``` The application panicked (crashed). Message: index out of bounds: the len is 2 but the index is 2 Location: src/nix.rs:128 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⋮ 7 frames hidden ⋮ 8: core::panicking::panic_bounds_check::h927eee4b8cc0749f at <unknown source file>:<unknown line> 9: nix_your_shell::nix::transform_nix::hcca3fcc3ee263aeb at <unknown source file>:<unknown line> 10: nix_your_shell::main::he77c85bcd3feab97 at <unknown source file>:<unknown line> 11: std::sys_common::backtrace::__rust_begin_short_backtrace::hf75262ecf6c0fa18 at <unknown source file>:<unknown line> 12: std::rt::lang_start::{{closure}}::h8cc63ff27203ca52 at <unknown source file>:<unknown line> 13: std::panicking::try::h45c8379f4866ecc7 at <unknown source file>:<unknown line> 14: std::rt::lang_start_internal::hf358ddc7f05da9a0 at <unknown source file>:<unknown line> 15: main<unknown> at <unknown source file>:<unknown line> 16: __libc_start_call_main<unknown> at <unknown source file>:<unknown line> 17: __libc_start_main@GLIBC_2.2.5<unknown> at <unknown source file>:<unknown line> 18: _start<unknown> at <unknown source file>:<unknown line> Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering. Run with RUST_BACKTRACE=full to include source snippets. ``` (sorry should have done that when opening the issue 🙈)
Owner

nix_your_shell::main

Blam: d49229504e/src/nix.rs (L126-L130)

Awesome, thank you. The world now makes slightly more sense.

Does this not happen with upstream Nix though? At first glance this looks like it'd be a bug in nix-your-shell. Hm.

> nix_your_shell::main Blam: https://github.com/MercuryTechnologies/nix-your-shell/blob/d49229504eb7b34b06b07b9acc318a7ec5b47107/src/nix.rs#L126-L130 Awesome, thank you. The world now makes slightly more sense. Does this not happen with upstream Nix though? At first glance this looks like it'd be a bug in nix-your-shell. Hm.
Author
Member

oh I didn't consider that, maybe nix_your_shell does load a repl plugin, I think @9999years might know.
just checked, also happens with upstream nix.
I guess I'm going to open a bug report at https://github.com/MercuryTechnologies/nix-your-shell
sorry for the noise.

oh I didn't consider that, maybe nix_your_shell does load a repl plugin, I think @9999years might know. just checked, also happens with upstream nix. I guess I'm going to open a bug report at https://github.com/MercuryTechnologies/nix-your-shell sorry for the noise.
Owner

@rbt is her

@rbt is her
Owner
https://github.com/MercuryTechnologies/nix-your-shell/issues/71 filed here
Owner

closing this since i think it is not our bug.

closing this since i think it is not our bug.
jade closed this issue 2024-03-26 22:33:34 +00:00
qyriad added the
Status
invalid
label 2024-03-26 23:16:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#184
No description provided.