Only use the global fish_complete_path and fish_function_path

Prior to this fix, fish would attempt to react if a local fish_complete_path
or fish_function_path were set. However this has never been very well tested
and will become impossible with concurrent execution. Always use the global
values.
This commit is contained in:
ridiculousfish 2019-07-12 12:19:00 -07:00
parent 7ee675afcf
commit d577eb4aaa
3 changed files with 5 additions and 3 deletions

View file

@ -17,6 +17,7 @@
- Some parser errors did not set `$status` to non-zero. This has been corrected (b2a1da602f79878f4b0adc4881216c928a542608). - Some parser errors did not set `$status` to non-zero. This has been corrected (b2a1da602f79878f4b0adc4881216c928a542608).
- `string` has a new `collect` subcommand that disables newline-splitting on its input. This is meant to be used as the end of a command substitution pipeline to produce a single output argument potentially containing internal newlines, such as `set output (some-cmd | string collect)`. Any trailing newlines are trimmed, just like `"$(cmd)"` substitution in sh. It also supports a `--no-trim-newlines` flag to disable trailing newline trimming, which may be useful when doing something like `set contents (cat filename | string collect -N)` (#159). - `string` has a new `collect` subcommand that disables newline-splitting on its input. This is meant to be used as the end of a command substitution pipeline to produce a single output argument potentially containing internal newlines, such as `set output (some-cmd | string collect)`. Any trailing newlines are trimmed, just like `"$(cmd)"` substitution in sh. It also supports a `--no-trim-newlines` flag to disable trailing newline trimming, which may be useful when doing something like `set contents (cat filename | string collect -N)` (#159).
- More of the documentation, including the tutorial, is now available as man pages as well. - More of the documentation, including the tutorial, is now available as man pages as well.
- Local values for `fish_complete_path` and `fish_function_path` are now ignored; only their global values are respected.
### Syntax changes and new commands ### Syntax changes and new commands
- Brace expansion now only takes place if the braces include a "," or a variable expansion, so things like `git reset HEAD@{0}` now work (#5869). - Brace expansion now only takes place if the braces include a "," or a variable expansion, so things like `git reset HEAD@{0}` now work (#5869).

View file

@ -873,8 +873,9 @@ static void complete_load(const wcstring &name) {
// It's important to NOT hold the lock around completion loading. // It's important to NOT hold the lock around completion loading.
// We need to take the lock to decide what to load, drop it to perform the load, then reacquire // We need to take the lock to decide what to load, drop it to perform the load, then reacquire
// it. // it.
const environment_t &vars = parser_t::principal_parser().vars(); // Note we only look at the global fish_function_path and fish_completion_path.
maybe_t<wcstring> path_to_load = completion_autoloader.acquire()->resolve_command(name, vars); maybe_t<wcstring> path_to_load =
completion_autoloader.acquire()->resolve_command(name, env_stack_t::globals());
if (path_to_load) { if (path_to_load) {
autoload_t::perform_autoload(*path_to_load, parser); autoload_t::perform_autoload(*path_to_load, parser);
completion_autoloader.acquire()->mark_autoload_finished(name); completion_autoloader.acquire()->mark_autoload_finished(name);

View file

@ -104,7 +104,7 @@ static void try_autoload(const wcstring &name, parser_t &parser) {
{ {
auto funcset = function_set.acquire(); auto funcset = function_set.acquire();
if (funcset->allow_autoload(name)) { if (funcset->allow_autoload(name)) {
path_to_autoload = funcset->autoloader.resolve_command(name, parser.vars()); path_to_autoload = funcset->autoloader.resolve_command(name, env_stack_t::globals());
} }
} }