[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 6/8] builtins/source: use source path in isolated mode
From: |
Koichi Murase |
Subject: |
Re: [PATCH v2 6/8] builtins/source: use source path in isolated mode |
Date: |
Tue, 14 May 2024 08:39:38 +0900 |
2024年5月13日(月) 19:40 Matheus Afonso Martins Moreira
<matheus.a.m.moreira@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()'.
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, (continued)
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/15
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Koichi Murase, 2024/05/15
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Matheus Afonso Martins Moreira, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Robert Elz, 2024/05/14
- Re: [PATCH v2 5/8] builtins/source: parse the -i option, Chet Ramey, 2024/05/15
[PATCH v2 6/8] builtins/source: use source path in isolated mode, Matheus Afonso Martins Moreira, 2024/05/13
Re: [PATCH v2 6/8] builtins/source: use source path in isolated mode, Chet Ramey, 2024/05/14
Re: [PATCH v2 6/8] builtins/source: use source path in isolated mode, Koichi Murase, 2024/05/14
Re: [PATCH v2 6/8] builtins/source: use source path in isolated mode, Chet Ramey, 2024/05/15
Re: [PATCH v2 6/8] builtins/source: use source path in isolated mode, Koichi Murase, 2024/05/15
[PATCH v2 7/8] variables: define default BASH_SOURCE_PATH, Matheus Afonso Martins Moreira, 2024/05/13
[PATCH v2 8/8] shell: restrict BASH_SOURCE_PATH when appropriate, Matheus Afonso Martins Moreira, 2024/05/13