bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: [PATCH 0/4] Add import builtin


From: Matheus Afonso Martins Moreira
Subject: Re: Re: [PATCH 0/4] Add import builtin
Date: Wed, 08 May 2024 18:56:19 +0000

> This is your key assertion, and it does not appear to have achieved
> consensus.

That's true, unfortunately.

>> The behavior of the source builtin already has several special cases.
> Do you mean the treatment of the DEBUG trap? That's for the debugger.

I mean that the source builtin already behaves differently
depending on the state of the shell. The bash documentation
for the source builtin states:

> If filename does not contain a slash,
> the PATH variable is used to find filename,
> but filename does not need to be executable.

> When Bash is not in POSIX mode,
> it searches the current directory
> if filename is not found in $PATH.

I thought that simply adding the BASH_SOURCE_PATH 
variable would end up adding a new if statement to the
documentation. Something like:

> If the BASH_SOURCE_PATH environment variable
> is defined, bash will search for filename in the
> directories specified by it first, falling back to
> PATH if not found.

I interpreted that as adding complexity to the builtin
and sought to avoid it by taking another approach.
The result would be documented like this:

> If the -l option is passed, bash searches the directories
> specified by BASH_LIBRARIES _PATH only. PATH is ignored.

I thought that was simpler.

  -- Matheus



reply via email to

[Prev in Thread] Current Thread [Next in Thread]