From 84dbdf4e2ad35306af90c8fbb0b18945b1380275 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Thu, 2 Oct 2025 10:02:26 +0200 Subject: [PATCH] Unbreak hack to strip " (deleted)" suffix from executable path Commit 49b88868dff (Fix stripping of " (deleted)" from non-UTF8 paths to fish, 2024-10-12) was wrong because Path::ends_with() considers entire path components. Fix that. Refs: - https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$k2IQazfmztFUXrairmIQvx_seS1ZJ7HlFWhmNy479Dg - https://matrix.to/#/!YLTeaulxSDauOOxBoR:matrix.org/$4pugfHejL9J9L89zuFU6Bfg41UMjA0y79orc3EaBego (cherry picked from commit 7b59ae0d82d0b3bf8c56365ec9dc7a38bf204613) --- src/common.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common.rs b/src/common.rs index 42cde027d..9b78c6a5d 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1654,7 +1654,7 @@ pub fn get_executable_path(argv0: impl AsRef) -> PathBuf { // When /proc/self/exe points to a file that was deleted (or overwritten on update!) // then linux adds a " (deleted)" suffix. // If that's not a valid path, let's remove that awkward suffix. - if !path.ends_with(" (deleted)") { + if path.as_os_str().as_bytes().ends_with(b" (deleted)") { return path; }