From c05b8f6879bad7fa9a49094b15a39a45a0b458d6 Mon Sep 17 00:00:00 2001 From: James Trew <66286082+jamestrew@users.noreply.github.com> Date: Sun, 9 Mar 2025 18:34:49 -0400 Subject: fix: improve broken symlink error handling (#2589) Check atuin setting paths (eg. `db_path`) for broken symlinks on initialization and disable all shell hooks + print error message. sqlite doesn't create db files even with `.create_if_missing` when the db files are a broken symlink. This would cause sqlite to error and atuin to panic on every single keypress. Also improves related error handling when calling atuin client commands directly. --- crates/atuin-common/src/utils.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'crates/atuin-common/src') diff --git a/crates/atuin-common/src/utils.rs b/crates/atuin-common/src/utils.rs index fbf2ef82..d495de36 100644 --- a/crates/atuin-common/src/utils.rs +++ b/crates/atuin-common/src/utils.rs @@ -113,6 +113,11 @@ pub fn get_current_dir() -> String { } } +pub fn broken_symlink>(path: P) -> bool { + let path = path.into(); + path.is_symlink() && !path.exists() +} + pub fn is_zsh() -> bool { // only set on zsh env::var("ATUIN_SHELL_ZSH").is_ok() -- cgit v1.3.1