Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Matheus Afonso Martins Moreira
> I'm thinking of the theoretical case in which a user exports BASH_SOURCE_PATH > then runs existing scripts - not necessarily of their own design > that weren't counting on this feature to ever exist. The option solution completely avoids that possibility. Existing scripts do not pass any options

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Matheus Afonso Martins Moreira
> It does not. It searches for readable files. Look at > findcmd.c:find_path_file(). That's true, I stand corrected. I was thinking of the find_user_command function because it's what I based the find_user_library function on. They are all implemented in terms of the find_user_command_internal. T

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Chet Ramey
On 5/7/24 3:40 PM, Kerin Millar wrote: On Tue, 7 May 2024, at 7:14 PM, Chet Ramey wrote: On 5/7/24 1:42 PM, Kerin Millar wrote: On Tue, 7 May 2024, at 3:27 PM, Chet Ramey wrote: On 5/5/24 3:39 PM, Kerin Millar wrote: Such is the extent to which I concur that I find even -l to be irritating.

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Kerin Millar
On Tue, 7 May 2024, at 7:14 PM, Chet Ramey wrote: > On 5/7/24 1:42 PM, Kerin Millar wrote: >> On Tue, 7 May 2024, at 3:27 PM, Chet Ramey wrote: >>> On 5/5/24 3:39 PM, Kerin Millar wrote: >>> Such is the extent to which I concur that I find even -l to be irritating. >>> >>> The option character

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Chet Ramey
On 5/7/24 1:42 PM, Kerin Millar wrote: On Tue, 7 May 2024, at 3:27 PM, Chet Ramey wrote: On 5/5/24 3:39 PM, Kerin Millar wrote: Such is the extent to which I concur that I find even -l to be irritating. The option character isn't important. Is it useful to have an additional If it were of

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Kerin Millar
On Tue, 7 May 2024, at 3:27 PM, Chet Ramey wrote: > On 5/5/24 3:39 PM, Kerin Millar wrote: > >> Such is the extent to which I concur that I find even -l to be irritating. > > The option character isn't important. Is it useful to have an additional If it were of no importance at all, once might the

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Chet Ramey
On 5/5/24 11:55 PM, Matheus Afonso Martins Moreira wrote: Such is the extent to which I concur that I find even -l to be irritating. Well, I don't concur at all. I think it's just the opposite. I think it's actually the source builtin which incorrectly implies that all sourced scripts are execu

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Chet Ramey
On 5/5/24 3:39 PM, Kerin Millar wrote: Such is the extent to which I concur that I find even -l to be irritating. The option character isn't important. Is it useful to have an additional option to `source' that forces it to use $BASH_SOURCE_PATH, or should that behave like other builtins ($CDP

Re: Re: Re: [PATCH 0/9] Add library mode to source builtin

2024-05-07 Thread Koichi Murase
Honestly, I share the same feeling as the others about the name `library'. The use of the ``library'' feels something wrong in this context. I still think the variable name should be BASH_SOURCE_PATH. I've suggested `-l' as an *example*, but that's just because I couldn't come up with another lett

Re: Re: Re: [PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Matheus Afonso Martins Moreira
> Libraries are 'compiled collection of object module', can be static/dynamic, > dynamic imply a runtime load. By this definition, dynamic languages and scripting languages don't have libraries. They clearly do have libraries. Sometimes they're called modules but it's the same thing. > This is

Re: Re: [PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Phi Debian
On Mon, May 6, 2024 at 5:43 AM Matheus Afonso Martins Moreira < math...@matheusmoreira.com> wrote: > > I think every single use of the term "library" in this whole endeavor > > is misleading and misguided. > > I don't think so. A library is just a logical collection of code and data > that you can

Re: Re: [PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Matheus Afonso Martins Moreira
> Such is the extent to which I concur that I find even -l to be irritating. Well, I don't concur at all. I think it's just the opposite. I think it's actually the source builtin which incorrectly implies that all sourced scripts are executables when they might actually be libraries and modules.

Re: Re: [PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Matheus Afonso Martins Moreira
> I think every single use of the term "library" in this whole endeavor > is misleading and misguided. I don't think so. A library is just a logical collection of code and data that you can use to implement software. This is a mechanism meant to load those libraries separately from executables. T

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Kerin Millar
On Sun, 5 May 2024, at 8:11 PM, Lawrence Velázquez wrote: > On Sun, May 5, 2024, at 5:54 AM, Matheus Afonso Martins Moreira wrote: >> This patch set adds a special operating mode to the existing source >> builtin to make it behave in the desired way. When source is passed >> the options --library o

Re: [PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Lawrence Velázquez
On Sun, May 5, 2024, at 5:54 AM, Matheus Afonso Martins Moreira wrote: > This patch set adds a special operating mode to the existing source > builtin to make it behave in the desired way. When source is passed > the options --library or -l, it will search for files in the > directories given by th

[PATCH 0/9] Add library mode to source builtin

2024-05-05 Thread Matheus Afonso Martins Moreira
Bash scripts can be tricky to get right so reusing proven solutions as shell script libraries is of immense value. However, the existing shell script sourcing mechanisms are suboptimal for this task. The source builtin uses the PATH variable for resolving file names which means they would have to