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

[Bug]: Atuin crashes when path contains non-unicode bytes #2428

Open
1 task done
printfn opened this issue Oct 21, 2024 · 1 comment
Open
1 task done

[Bug]: Atuin crashes when path contains non-unicode bytes #2428

printfn opened this issue Oct 21, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@printfn
Copy link

printfn commented Oct 21, 2024

What did you expect to happen?

Atuin shouldn't crash just because the I'm using non-unicode bytes in filepaths

What happened?

With atuin installed, run:

mkdir $'\xff'
cd $'\xff'

I get the following stacktrace:

thread 'main' panicked at library/std/src/env.rs:171:83:
called `Result::unwrap()` on an `Err` value: "/home/user/chess/\xFF"
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::result::unwrap_failed
   3: <std::env::Vars as core::iter::traits::iterator::Iterator>::next
   4: <config::env::Environment as config::source::Source>::collect
   5: config::source::Source::collect_to
   6: <[alloc::boxed::Box<dyn config::source::Source+core::marker::Send+core::marker::Sync>] as config::source::Source>::collect
   7: config::builder::ConfigBuilder<config::builder::DefaultState>::build_internal
   8: config::builder::ConfigBuilder<config::builder::DefaultState>::build
   9: atuin_client::settings::Settings::new
  10: atuin::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Atuin doctor output

{
  "atuin": {
    "version": "18.3.0",
    "sync": {
      "cloud": true,
      "records": true,
      "auto_sync": true,
      "last_sync": "2024-10-21 10:02:53.814094109 +00:00:00"
    },
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Ubuntu",
    "arch": "x86_64",
    "version": "22.04",
    "disks": [
      {
        "name": "none",
        "filesystem": "9p"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      },
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "none",
        "filesystem": "overlay"
      },
      {
        "name": "C:\\134",
        "filesystem": "9p"
      },
      {
        "name": "N:\\134",
        "filesystem": "9p"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      },
      {
        "name": "/dev/sdc",
        "filesystem": "ext4"
      },
      {
        "name": "snapfuse",
        "filesystem": "fuse.snapfuse"
      }
    ]
  }
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@printfn printfn added the bug Something isn't working label Oct 21, 2024
@printfn
Copy link
Author

printfn commented Oct 21, 2024

It looks like the bug is caused by this env::vars() line, which crashes atuin if any environment variable (in this case PWD) contains non-unicode characters:

https://github.com/mehcode/config-rs/blob/v0.13.4/src/env.rs#L239

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

1 participant