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:36:54 -0400
User-agent: Mozilla Thunderbird

On 5/18/24 11:17 AM, Phi Debian wrote:

an enforcement that no
alias source='source -i' could ever be possible.

This seems ridiculous. There should never be a prohibition against a user
doing something that is not dangerous.

All this is because one writing a 'main' script (#!/bin/bash), sourcing a
package of mine through my package management system, expecting the current
source behavior, and later add the loading of a 'libraries' from a friend
(terminal color jazz) that in turn start to mess around with alias
source='source -i' and BASH_SOURCE_PATH cold start to break my way of
finding my packages.

If you're worried about this, unalias source after loading this friend's
`library'. You're already changing your environment to include it.


An alternative to this would be
BASH_SOURCE_PATH="" don't do nothing with 'source', and allow the
'libraries' designer to do
typeset -r BASH_SOURCE_PATH=""

No. If you want to make sure it's unset, force it to remain unset, and
prevent anyone from setting it,

unset BASH_SOURCE_PATH
readonly BASH_SOURCE_PATH

will do the job.

--
``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]