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

Deleting nushell config directory leads to crash #5203

Closed
bugabinga opened this issue Apr 15, 2022 · 9 comments
Closed

Deleting nushell config directory leads to crash #5203

bugabinga opened this issue Apr 15, 2022 · 9 comments
Labels
🐛 bug Something isn't working polish this problem makes nu feel unpolished
Milestone

Comments

@bugabinga
Copy link

bugabinga commented Apr 15, 2022

Describe the bug

When deleting the nushell config folder (~/.config/nushell in my case) a running instance of nu terminates.

How to reproduce

  1. Make sure no instance of nu is running.
  2. Delete the nushell config directory eg. ~/.config/nushell
  3. Start nu
  4. Would you like to create one with defaults (Y/n): -> n
  5. Would you like to create one with defaults (Y/n): -> n
  6. Run rm --recursive --force ( $nu.config-path | path dirname )
No environment config file found at /home/oli/.config/nushell/env.nu
Would you like to create one with defaults (Y/n):
n
Continuing without config file
No config file found at /home/oli/.config/nushell/config.nu
Would you like to create one with defaults (Y/n):
n
Continuing without config file
/home/oli〉rm --recursive --force ( $nu.config-path | path dirname )      04/15/2022 12:55:37 PM
╭───┬───────────────────────────────────╮
│ 0 │ deleted /home/oli/.config/nushell │
╰───┴───────────────────────────────────╯
Error:

[Process didn't exit cleanly. (exit_behavior="CloseOnCleanExit")]
  × No such file or directory (os error 2)

The error message at the end comes from WezTerm. Your particular terminal emulator might react differently.

Expected behavior

I expected nu to ask to recreate the missing config files, like it did on first start.

Screenshots

No response

Configuration

key value
version 0.61.0
branch
tag
build_os linux-x86_64
rust_version rustc 1.60.0 (7737e0b5c 2022-04-04)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.60.0 (d1fd9fe 2022-03-01)
pkg_version 0.61.0
build_time 2022-04-15 12:01:56 +02:00
build_rust_channel release
features dataframe, default, trash, which, zip
installed_plugins

Additional context

No response

@fdncred fdncred added 🐛 bug Something isn't working polish this problem makes nu feel unpolished labels Apr 15, 2022
@WindSoilder
Copy link
Collaborator

WindSoilder commented Jun 3, 2022

@bugabinga Hi, can you please try latest build and check if it's still panic?

I expected nu to ask to recreate the missing config files, like it did on first start.

Personally I'd suggest no need to recreate the missing config files, just restart nu is enough

@bugabinga
Copy link
Author

@WindSoilder Hi, do you mean the latest release or the main branch?

Assuming you meant latest release, the issue is reproducible.
I have amended the steps to reproduce, because I found them not as clear as they could be.

column0 column1
version 0.63.0
branch
commit_hash
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.61.0 (fe5b13d68 2022-05-18)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.61.0 (a028ae4 2022-04-29)
pkg_version 0.63.0
build_time 2022-06-03 09:51:45 +02:00
build_rust_channel release
features database, dataframe, default, trash, which, zip
installed_plugins

@bugabinga
Copy link
Author

I have tested again with latest main branch and it seems I can also reproduce the issue.

oli@pop-os:~/Workspace/nushell$ git rev-parse --verify HEAD
a75318d7e8bc8d88043d2e982b26dcb58308acb6

oli@pop-os:~/Workspace/nushell$ ls ~/.config/nushell
ls: cannot access '/home/oli/.config/nushell': No such file or directory

oli@pop-os:~/Workspace/nushell$ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/nu`
No environment config file found at /home/oli/.config/nushell/env.nu
Would you like to create one with defaults (Y/n): 
n
Continuing without config file
No config file found at /home/oli/.config/nushell/config.nu
Would you like to create one with defaults (Y/n): 
n
Continuing without config file
/home/oli/Workspace/nushell〉rm --recursive --force ( $nu.config-path | path dirname )
Error: 
  × No such file or directory (os error 2)

oli@pop-os:~/Workspace/nushell$ 

Personally I'd suggest no need to recreate the missing config files, just restart nu is enough

As long as it does not panic, this would be also fine from my point of view.

@WindSoilder
Copy link
Collaborator

WindSoilder commented Jun 3, 2022

Sorry for my unclear message, I mean the latest main.

Can you please try cargo clean first, then run cargo run and check again?

@bugabinga
Copy link
Author

No problem:

💻/nushell   main ▶ cargo clean                                                                                                    ✓ 03.06 19:51

💻/nushell   main ▶ cargo run                                                                                                629ms ✓ 03.06 19:53
    Updating crates.io index
    Updating git repository `https://github.com/nushell/reedline`
  Downloaded bytesize v1.1.0
  Downloaded byteorder v1.4.3
  Downloaded adler v1.0.2
  Downloaded bytes v1.1.0
   ...
   Compiling nu-parser v0.63.1 (/home/oli/Workspace/nushell/crates/nu-parser)
   Compiling nu-cli v0.63.1 (/home/oli/Workspace/nushell/crates/nu-cli)
    Finished dev [unoptimized + debuginfo] target(s) in 6m 38s
     Running `target/debug/nu`

💻/nushell   main ▶ rm -f ($nu.config-path | path dirname)                                                                   823ms ✓ 03.06 20:00
Error:
  × No such file or directory (os error 2)

Error:
  × No such file or directory (os error 2)

We get 2 errors because I launched cargo run inside nu.
This time a also set $env.RUST_BACKTRACE to full, but apparently there is no panic here.

@WindSoilder
Copy link
Collaborator

WindSoilder commented Jun 4, 2022

Hmm.....The error message shouldn't occurred, I can't reproduce it in my machine:-( I'll try linux in other day

@merelymyself
Copy link
Contributor

gabriel at pop-os in ~/C/nushell
↪ echo $RUST_BACKTRACE
full
gabriel at pop-os in ~/C/nushell
↪ cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.18s
     Running `target/debug/nu`
No environment config file found at /home/gabriel/.config/nushell/env.nu
Would you like to create one with defaults (Y/n):
y
Config file created at: /home/gabriel/.config/nushell/env.nu
No config file found at /home/gabriel/.config/nushell/config.nu
Would you like to create one with defaults (Y/n):
y
Config file created at: /home/gabriel/.config/nushell/config.nu
/home/gabriel/CodingProjects/nushell〉rm -rf ($nu.config-path | path dirname) 06/04/2022 02:06:48 PM
Error:
  × No such file or directory (os error 2)

and of course,

key value
version 0.63.1
branch main
commit_hash 6baf718
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.61.0 (fe5b13d68 2022-05-18)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.61.0 (a028ae4 2022-04-29)
pkg_version 0.63.1
build_time 2022-05-29 23:47:21 +08:00
build_rust_channel debug
features default, trash, which, zip
installed_plugins

@WindSoilder
Copy link
Collaborator

WindSoilder commented Jun 4, 2022

What about trying this? In linux, I can use this to make a fresh nu build with the newest reedline dependency

> cargo clean
> cargo update
> cargo run

@bugabinga
Copy link
Author

@WindSoilder well done!

The issue seems fixed after following your instructions. Or it is simply gone in 0.64.0 :).

column0 column1
version 0.64.0
branch main
commit_hash cb66d2b
build_os linux-x86_64
build_target x86_64-unknown-linux-gnu
rust_version rustc 1.61.0 (fe5b13d68 2022-05-18)
rust_channel stable-x86_64-unknown-linux-gnu
cargo_version cargo 1.61.0 (a028ae4 2022-04-29)
pkg_version 0.64.0
build_time 2022-06-15 14:41:32 +02:00
build_rust_channel debug
features default, trash, which, zip
installed_plugins gstat

@hustcer hustcer added this to the v0.64.0 milestone Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working polish this problem makes nu feel unpolished
Projects
None yet
Development

No branches or pull requests

5 participants