mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-27 14:45:13 +08:00
status fish-path: Remove "(deleted)" suffix
Fixes #9018. (cherry picked from commit 6e0653af9325844ff1701d332ec8e2e0b57d8ee3)
This commit is contained in:
parent
a396fdc907
commit
687a16b260
@ -5,6 +5,7 @@ This release of fish fixes a number of problems identified in fish 3.5.0.
|
|||||||
|
|
||||||
- Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`).
|
- Completing ``git blame`` or ``git -C`` works correctly (:issue:`9053`).
|
||||||
- On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`).
|
- On terminals that emit a ``CSI u`` sequence for :kbd:`Shift-Space`, fish inserts a space instead of printing an error. (:issue:`9054`).
|
||||||
|
- ``status fish-path`` on Linux-based platforms could print the path with a " (deleted)" suffix (such as ``/usr/bin/fish (deleted)``), which is now removed (:issue:`9019`).
|
||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
|
@ -1900,7 +1900,17 @@ std::string get_executable_path(const char *argv0) {
|
|||||||
}
|
}
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
buff[len] = '\0';
|
buff[len] = '\0';
|
||||||
return std::string(buff);
|
// 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.
|
||||||
|
std::string buffstr{buff};
|
||||||
|
if (access(buff, F_OK)) {
|
||||||
|
auto dellen = const_strlen(" (deleted)");
|
||||||
|
if (buffstr.size() > dellen && buffstr.compare(buffstr.size() - dellen, dellen, " (deleted)") == 0) {
|
||||||
|
buffstr = buffstr.substr(0, buffstr.size() - const_strlen(" (deleted)"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buffstr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user