From d370cd3e6c17b3bb5b177f930ac08722d8814859 Mon Sep 17 00:00:00 2001 From: YangYunYi Date: Mon, 26 May 2025 20:17:43 +0800 Subject: [PATCH] fix cannot find ld-linux.so when install ubuntu htop when a soft link is created, if the linked file is a relative path (../), it should be combined with the directory where the soft link file is located, not the fs directory where the software package is stored. --- src/install.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/install.rs b/src/install.rs index c49be9d..1aa7a53 100644 --- a/src/install.rs +++ b/src/install.rs @@ -152,8 +152,9 @@ fn shortcut_symlink(store_fs_dir: &Path, fs_file: &Path, target_path: &Path) -> // Note: Using Path.join() here would incorrectly handle absolute paths by discarding the base path PathBuf::from(format!("{}/{}", store_fs_dir.display(), link_target.display())) } else if link_target.starts_with("../") { - // For parent-relative paths like ../bin/pidof, normalize against store_fs_dir - normalize_join(store_fs_dir, &link_target) + // For parent-relative paths like ../bin/pidof, normalize against fs_file + normalize_join(fs_file.parent().ok_or_else(|| eyre::eyre!("Failed to get parent directory for {}", fs_file.display()))?, + &link_target) } else { // For sibling-relative paths like python3.11, join with source file's parent fs_file.parent() -- Gitee