On 10/28/22 12:09 PM, Erik Adelbert wrote:
Hello Chet and other bash maintainers,

Thanks for your time.

On 27 Oct 2022, at 23:26, Chet Ramey <chet.ra...@case.edu <mailto:chet.ra...@case.edu>> wrote:

we believe the current semantic to be at least unclear and would like to see either:
0 the DEBUG trap called _before_ any function declaration (preferred)

While calling the DEBUG trap before certain compound commands has value, I
don't think that function definition commands rise to that level.

In the demonstrated case (2nd example of our report), we made clear that
commenting in/out a function definition *seemed* to make an unrelated
error appear/disappear from the debugging support because it was in the
vicinity.

There are a couple of ways to overcome that. You could save and restore the
value of $? around a function declaration, or you could reorder code so
that function definitions come before the command whose exit status you're
interested in.


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


Reply via email to