From 33735f507ab00757dae58f43755d5a5e779b9f3f Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 13 Sep 2025 11:14:28 +0200 Subject: [PATCH] Fix regression causing build/fish to use wrong config paths Commit 8b102f25716 (Stop using Cargo's OUT_DIR, 2025-06-22) accidentally removed canonicalization of FISH_BUILD_DIR=${CMAKE_BINARY_DIR}. This means that if the path to ${CMAKE_BINARY_DIR} includes a symlink, ${CMAKE_BINARY_DIR}/fish will wrongly use /usr/share/fish instead of ${CARGO_MANIFEST_DIR}/share. Fix this and reintroduce the comment. --- build.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index e6379b160..bdd4062c4 100644 --- a/build.rs +++ b/build.rs @@ -13,10 +13,14 @@ fn main() { let cargo_target_dir = fish_build_helper::get_target_dir(); - // FISH_BUILD_DIR is set by CMake, if we are using it. rsconf::set_env_value( "FISH_BUILD_DIR", - option_env!("FISH_BUILD_DIR").unwrap_or(cargo_target_dir.to_str().unwrap()), + // This is set by CMake and might include symlinks. Since we want to compare this to + // the dir fish is executed in we need to canonicalize it. + option_env!("FISH_BUILD_DIR") + .map_or(cargo_target_dir, fish_build_helper::canonicalize) + .to_str() + .unwrap(), ); // We need to canonicalize (i.e. realpath) the manifest dir because we want to be able to