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

Panic shortly after importing #99

Closed
conradludgate opened this issue May 10, 2021 · 2 comments
Closed

Panic shortly after importing #99

conradludgate opened this issue May 10, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@conradludgate
Copy link
Collaborator

Performing these two actions consistently gets me a panic

 oon@altair  ~/code/rust/atuin   main  rm ~/.local/share/atuin/history.db
 oon@altair  ~/code/rust/atuin   main  atuin import zsh
        Atuin
======================
          🌍
       🐘🐘🐘🐘
          🐢
======================
Importing history...
Importing history from zsh
Import complete!

Followed by Up

 oon@altair  ~/code/rust/atuin   main  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: OutOfRangeError(())', src/command/search.rs:45:67
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

https://github.com/ellie/atuin/blob/de2e34ac50/src/command/search.rs#L45

This seems to occur when chrono::Utc::now().sub(h.timestamp) is negative. I'm not sure why, perhaps there's a discrepancy in the ~/.zsh_history file where the timestamps are possibly a couple seconds in the future

    pub fn to_std(&self) -> Result<StdDuration, OutOfRangeError> {
        if self.secs < 0 {
            return Err(OutOfRangeError(()));
        }
        Ok(StdDuration::new(self.secs as u64, self.nanos as u32))
    }
@conradludgate conradludgate added the bug Something isn't working label May 10, 2021
@loveencounterflow
Copy link

loveencounterflow commented May 13, 2021

I'm experiencing the same, also with atuin import zsh using the cargo-installed version.

@ellie
Copy link
Member

ellie commented Oct 8, 2022

I believe we fixed this a while ago

@ellie ellie closed this as completed Oct 8, 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
Projects
None yet
Development

No branches or pull requests

3 participants