Patch for autoload.v3 to allow export of function

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Patch for autoload.v3 to allow export of function

Matthew Persico
I would like to submit a patch to the autoload.v3 script.

The modification would allow the export of the autoloaded function to subshells. 

autoload() would now take a -x option, pass it into _aload() which would then make the approrpiate calls to export -f. 

Where should it be discussed and how does one format and submit a patch (fork, clone, pull request or patch submission on the savanah site or something else)?

Thank uou
--
Matthew O. Persico
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Patch for autoload.v3 to allow export of function

Eduardo A. Bustamante López
On Wed, Feb 8, 2017 at 11:27 AM, Matthew Persico
<[hidden email]> wrote:
[...]
>
> Where should it be discussed and how does one format and submit a patch
> (fork, clone, pull request or patch submission on the savanah site or
> something else)?

Hi Matthew, you can send patches to this list, or to Chet Ramey. You
can see the archives (https://lists.gnu.org/archive/html/bug-bash/)
for example on how people submit patches, but it's basically just
email the patch.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Patch for autoload.v3 to allow export of function

Matthew Persico
Greetings!

I have finally gotten around to working on autoload again to ensure that
there are no issues. But I have a question about the _AUTOLOADS array,
which is used to track what has been autoloaded and is the source of
information for the -p command.

The code executes a linear scan of the array _AUTOLOADS each time it has to
find and element for removal or to make sure it is not about to add a
duplicate entry. This is hardly very efficient. Would it be OK to convert
that to an associative array (hash to us Perlers) indexed on function name?

I ask before submitting the patch because I am worried about backward
compatibility; I do not know when hashes were added to bash nor do I know
what the policy is about how far back compatibility has to be maintained.

Thank you!


--
Matthew O. Persico
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Patch for autoload.v3 to allow export of function

Chet Ramey
On 7/1/17 5:50 PM, Matthew Persico wrote:

> Greetings!
>
> I have finally gotten around to working on autoload again to ensure that
> there are no issues. But I have a question about the _AUTOLOADS array,
> which is used to track what has been autoloaded and is the source of
> information for the -p command.
>
> The code executes a linear scan of the array _AUTOLOADS each time it has to
> find and element for removal or to make sure it is not about to add a
> duplicate entry. This is hardly very efficient. Would it be OK to convert
> that to an associative array (hash to us Perlers) indexed on function name?
>
> I ask before submitting the patch because I am worried about backward
> compatibility; I do not know when hashes were added to bash nor do I know
> what the policy is about how far back compatibility has to be maintained.

Go ahead and submit the patch; if backwards compatibility is an issue, just
name it `autoload.v4'.  Associative arrays have been in bash since
bash-4.0, which was released in 2009, so including an updated version with
future bash distributions should not limit its usefulness.

Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU    [hidden email]    http://cnswww.cns.cwru.edu/~chet/

Loading...