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

2024-05-18 Thread Robert Elz
Date:Sat, 18 May 2024 23:00:41 + From:Matheus Afonso Martins Moreira Message-ID: | If you resolve the path, you're just reinventing the source builtin. Nonsense, the real work of the source ('.' really) utility is to read the file, parse it, and execute it.

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

2024-05-18 Thread Matheus Afonso Martins Moreira
> distros, sysadmins, and users can already break your scripts > in plenty of ways -- changing existing shell variables, setting > shopts your scripts don't account for, etc. Existing footguns doesn't justify addition of new ones. We have the ability to prevent a lot of breakage here. Shouldn't

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

2024-05-18 Thread Matheus Afonso Martins Moreira
> The issue is that what you want, and what I want, > and what konsolebox wants (and everyone else) > are all slighty different. The option solution which I proposed is not really in opposition to anything that anyone else wants. It will not break anything, it supports the same inputs and use

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

2024-05-18 Thread Lawrence Velázquez
On Sat, May 18, 2024, at 11:17 AM, Phi Debian wrote: > I am xing fingers the consensus, if any of theses takes off, > is to have [...] protection against alias source='source -i' This seems out of scope, regardless of what happens with "-i". > I really depend on actual 'source' behavior, and

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

2024-05-18 Thread Robert Elz
Date:Sat, 18 May 2024 08:39:57 -0300 From:Matheus Afonso Martins Moreira Message-ID: | As the user, it should be my prerogative to set the | variable on my environment and/or rc so that I can | organize my sourceable scripts however I want Of course. The

count in vi mode alters prompt

2024-05-18 Thread mohd . akram
Configuration Information [Automatically generated, do not change]: Machine: x86_64 OS: darwin23.2.0 Compiler: /usr/bin/clang Compilation CFLAGS: -pipe -Os -DSSH_SOURCE_BASHRC -isysroot/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk -arch x86_64 uname output: Darwin Mohameds-MBP 23.4.0

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

2024-05-18 Thread Lawrence Velázquez
On Sat, May 18, 2024, at 11:41 AM, Matheus Afonso Martins Moreira wrote: >> I am xing fingers the consensus, if any of theses takes off, >> is to have the -i implemented (not omitted) > > Me too. Do you know anyone else who could be impacted? > Consensus might move in that direction if more voices

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

2024-05-18 Thread Matheus Afonso Martins Moreira
> I am xing fingers the consensus, if any of theses takes off, > is to have the -i implemented (not omitted) Me too. Do you know anyone else who could be impacted? Consensus might move in that direction if more voices make themselves heard on this list. > if one, distro, sysadmin, and ultimatly

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

2024-05-18 Thread Phi Debian
On Sat, May 18, 2024 at 3:23 PM Matheus Afonso Martins Moreira < math...@matheusmoreira.com> wrote: > > > 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

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

2024-05-18 Thread Matheus Afonso Martins Moreira
> 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

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

2024-05-18 Thread Greg Wooledge
On Sat, May 18, 2024 at 08:39:57AM -0300, Matheus Afonso Martins Moreira wrote: > > Setting the variable at all is opting in to new behavior, and you do > > that at your own risk, after reading the documentation and deciding > > that this is what you want. > > As the user, it should be my

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

2024-05-18 Thread Matheus Afonso Martins Moreira
> Setting the variable at all is opting in to new behavior, and you do > that at your own risk, after reading the documentation and deciding > that this is what you want. As the user, it should be my prerogative to set the variable on my environment and/or rc so that I can organize my sourceable

Re: proposed BASH_SOURCE_PATH

2024-05-18 Thread konsolebox
On Sat, May 18, 2024 at 9:18 AM Martin D Kealey wrote: > On Thu, 16 May 2024 at 22:50, konsolebox wrote: >> >> On Thu, May 16, 2024 at 4:59 PM Martin D Kealey >> wrote: >> > As I understood your counter-proposal, it would result in this: >> > * ./a and ./b/c/d would be treated as relative to

Re: source -i prototype implementation and other features

2024-05-18 Thread konsolebox
I also uploaded a copy of the script and the patch to gist: https://gist.github.com/konsolebox/a908cf13e511abdf05daec89a9cbdd8d -- konsolebox

source -i prototype implementation and other features

2024-05-18 Thread konsolebox
This is what I think an acceptable implementation of `source -i` should look like: #!/bin/bash if [[ BASH_VERSINFO -ge 5 && ${SOURCE_EXTENSIONS_LOADED-} != true ]]; then function source._die { printf '%s\n' "$1" >&2 exit "${2-1}" } function