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: Chet Ramey
Subject: Re: [PATCH v2 5/8] builtins/source: parse the -i option
Date: Mon, 20 May 2024 15:48:53 -0400
User-agent: Mozilla Thunderbird

On 5/18/24 7:00 PM, Matheus Afonso Martins Moreira wrote:
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 cases as before, including
the absolute path case you cited.

I don't think Phi agrees with that.


Pure bash solutions have two choices and both of them break stuff.
Either they clobber PATH, or they resolve the file's path on their own
and pass an absolute path to the source builtin. If you clobber PATH,
sourced scripts can't easily find commands anymore.

No. If you want to run commands out of one of these `library' files, there
are a couple of ways to do it. Either the library can change, or you can
run `PATH=$BASH_SOURCE_PATH:$PATH .' (or similar).

That completely
changes the way that scripts work and therefore the way they must
be written.

Not at all.

If you resolve the path, you're just reinventing the source
builtin. It also depends on source actually accepting the absolute path
which renders it incompatible with restricted shells.

Only if you want to run it after the startup files are read and the
restrictions are enforced. In a restricted environment -- not so common
anymore -- I can't see a use for this after the startup files are read.

The option solution completely avoids all that.

And yet people are so opposed to the option that they want ridiculous
restrictions like `you can never alias source="source -i"'.

I don't really understand why there seems to be so much
opposition to this.

Because other people don't see the issue the same way you do, and have
their own way of doing things?

--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    chet@case.edu    http://tiswww.cwru.edu/~chet/

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


reply via email to

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