2024年5月13日(月) 19:40 Matheus Afonso Martins Moreira <matheus.a.m.more...@gmail.com>: > diff --git a/builtins/source.def b/builtins/source.def > index 26040e70..7f870bfe 100644 > --- a/builtins/source.def > +++ b/builtins/source.def > @@ -177,6 +178,27 @@ search_for_file (WORD_LIST *list) > [...] > +static char * > +isolated_search_for_file (WORD_LIST *list) > [...] > + if (filename == 0) > + { > + if (source_searches_cwd == 0) > + return (NULL); > + else > + filename = savestring (list->word->word); > + }
* With this, `isolated_search_for_file()' falls back to local files in the current working directory. I'm unsure about whether this is intentional, but I think we should restrict the search in BASH_SOURCE_PATH and shouldn't fall back to local files. In that case, we need to make sure that `find_in_path_var()' returns NULL in the case of empty BASH_SOURCE_PATH. In the current implementation, `find_in_path_var()' seems to return `save_string (name)' for empty BASH_SOURCE_PATH, which would induce the search in the current working directory. * Even if we intensionally fall back to local files, this part seems just a repetition of `search_for_file()'. I think this common part should be moved to `builtin_source()'.