bug-bash
[Top][All Lists]
Advanced

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

Re: [PATCH v2 5/8] builtins/source: parse the -i option


From: Matheus Afonso Martins Moreira
Subject: Re: [PATCH v2 5/8] builtins/source: parse the -i option
Date: Sat, 18 May 2024 13:23:09 +0000

> You've made contradictory statements here.

I don't see how.

> First you said you wanted to put it into your *environment*.

Yes.

> That would cause shell scripts to see it and exhibit a change in behavior.

Only if the -i option is not implemented.
If it is, there will be zero change in behavior
whether BASH_SOURCE_PATH is set or not.
Only if the script explicitly passes -i to source
will the behavior change.

> Next you said you would like to set it in your .bashrc file.
> That's totally different.

How is it different? If I export a variable in .bashrc,
and bash reads and evaluates that file at startup,
then that variable gets exported to the shell and
all processes spawned by it.

> Setting it in .bashrc *without* putting it into the
> environment (no export) is "safe".  It will only affect
> your interactive shell, and not any scripts that you run.

I know. I'm just saying it doesn't have to be that way.

I'm saying that in addition to it being safe if unset or
unexported, it could _also_ be made safe if exported.
The -i option provides that safety by requiring that
source code be changed in order to enable it.
Existing code will never be impacted by the feature
whether the variable is set or not, simply because
they do not pass -i to the source builtin.

  -- Matheus



reply via email to

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