diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ec2064bf..adfb6a955 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ - Implemented `string lower` and `string upper` (#4080). - `help` can now open the tutorial. - `echo -h` now correctly echoes `-h` (#4120). +- Stop converting empty elements in MANPATH to "." (#4158). The behavior being changed was introduced in fish 2.6.0. - Added completions for: - `as` (#4130). - `jest` (#4142). diff --git a/src/env.cpp b/src/env.cpp index 81f8e71e2..9dab7e006 100644 --- a/src/env.cpp +++ b/src/env.cpp @@ -99,9 +99,9 @@ static const wcstring_list_t locale_variables({L"LANG", L"LANGUAGE", L"LC_ALL", /// subsystem. static const wcstring_list_t curses_variables({L"TERM", L"TERMINFO", L"TERMINFO_DIRS"}); -/// List of all "path" like variable names that need special handling. This includes automatic +/// List of "path" like variable names that need special handling. This includes automatic /// splitting and joining on import/export. As well as replacing empty elements, which implicitly -/// refer to the CWD, with an explicit '.'. +/// refer to the CWD, with an explicit '.' in the case of PATH and CDPATH. static const wcstring_list_t colon_delimited_variable({L"PATH", L"MANPATH", L"CDPATH"}); // Some forward declarations to make it easy to logically group the code. @@ -332,6 +332,9 @@ static void handle_timezone(const wchar_t *env_var_name) { /// Unfortunately that convention causes problems for fish scripts. So this function replaces the /// empty path element with an explicit ".". See issue #3914. static void fix_colon_delimited_var(const wcstring &var_name) { + // While we auto split/join MANPATH we do not want to replace empty elements with "." (#4158). + if (var_name == L"MANPATH") return; + const env_var_t paths = env_get_string(var_name); if (paths.missing_or_empty()) return;