bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug: Bash forgets sourcefile and linenumber of read-in functions


From: Chet Ramey
Subject: Re: Bug: Bash forgets sourcefile and linenumber of read-in functions
Date: Mon, 11 Mar 2019 18:05:16 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:60.0) Gecko/20100101 Thunderbird/60.5.1

On 3/11/19 4:15 PM, L A Walsh wrote:
> 
> 
> On 3/6/2019 7:18 AM, Chet Ramey wrote:
>>> Except that .... the bash debugger gets lost on files that don't
>>> have a real source file name. Environment is not the name of the file
>>> containing the function -- it is a nebulous, ephemeral area of a
>>> process -- but it certainly is not the repository for source files
>>> that configure bash's behavior.
>>>     
>>
>> If you don't want functions to appear in the environment, don't put them
>> in the environment. Bash is reporting accurately where it read the
>> definition for `addnums'.
>>   
> 1) Where is it documented that if you export a function, the original
> source location is thrown away by bash? 

It's unreasonable to expect that a shell that reads a function definition
from the environment retains any original file and line information. The
only thing the documentation guarantees is that functions may be exported
so subshells have them defined. There's nothing in there that says a
function's file and line number information goes along with that.

> 
> 2). Ok, so it currently gets lost.  Why shouldn't it be fixed?


> Either always keep around source+line or just when some option is set.
> To minimize impact, I'd probably store all of them in 1 place so I can
> do text compression and encode in some storeable format -- at worse BASE64.

So do a sample implementation and see how it works. You can only use the
environment, since that's the only mechanism guaranteed to get information
from one process to another.


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



reply via email to

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