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

Atuin throws errors when inside a deleted directory #195

Closed
ajeetdsouza opened this issue Nov 1, 2021 · 5 comments · Fixed by #280
Closed

Atuin throws errors when inside a deleted directory #195

ajeetdsouza opened this issue Nov 1, 2021 · 5 comments · Fixed by #280
Labels
bug Something isn't working

Comments

@ajeetdsouza
Copy link

Steps to reproduce (on zsh):

# Initialize Atuin.
eval "$(atuin init zsh)"

# Enter a deleted directory.
mkdir /tmp/x
cd /tmp/x
rm -rf /tmp/x

# Now, run any command.
echo

Atuin throws this error for every command run:

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

Location:
    /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/result.rs:1897:27
@conradludgate
Copy link
Collaborator

Interesting the panic isn't tracking the caller, I wonder what version of rust atuin was built with on your system. I'm going to try repro locally and maybe change some of the unwraps to expects

@conradludgate
Copy link
Collaborator

The error occurs within the config crate. The default behaviour allows relative paths, and std::env::current_dir() will error if the current directory does not exist.

https://github.com/ellie/atuin/blob/main/atuin-client/src/settings.rs#L137
https://github.com/mehcode/config-rs/blob/master/src/file/source/file.rs#L106

@conradludgate
Copy link
Collaborator

Since I don't think it makes sense for us to support relative paths for a config file, I think we could read in the file contents ourselves through our absolute path, and provide the string instead: https://docs.rs/config/0.11.0/config/struct.File.html#method.from_str

@conradludgate
Copy link
Collaborator

I also realise the panic is thrown outside of main, so I'm gonna make a separate PR that makes better use of eyre contexts. That should help these bug reports be more insightful

@ajeetdsouza
Copy link
Author

Sounds awesome, thanks!

@conradludgate conradludgate added the bug Something isn't working label Nov 21, 2021
ellie added a commit that referenced this issue Mar 17, 2022
Also fix our call to current_dir

This should resolve #195

Thanks @conradludgate for the upstream fix!
@ellie ellie mentioned this issue Mar 17, 2022
ellie added a commit that referenced this issue Mar 17, 2022
Also fix our call to current_dir

This should resolve #195

Thanks @conradludgate for the upstream fix!
ellie added a commit that referenced this issue Mar 17, 2022
Also fix our call to current_dir

This should resolve #195

Thanks @conradludgate for the upstream fix!
ellie added a commit that referenced this issue Mar 17, 2022
* Update config-rs

Also fix our call to current_dir

This should resolve #195

Thanks @conradludgate for the upstream fix!

* Format
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

Successfully merging a pull request may close this issue.

2 participants