[Date Prev ][Date Next ][Thread Prev ][Thread Next ][Date Index ][Thread Index ]
[BUG] RETURN trap with -o functrace: infinite recursion on 'eval return'
From :
Martijn Dekker
Subject :
[BUG] RETURN trap with -o functrace: infinite recursion on 'eval return'
Date :
Tue, 10 Apr 2018 10:56:49 +0100
User-agent :
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.7.0
$ bash -o functrace -c 'fn() { eval "return"; }; trap "fn" RETURN; fn'
Result: segfault due to infinite recursion.
__________
Even apart from this bug with 'eval return', the effect of '-o
functrace' is a bit strange:
$ bash -o functrace -c 'fn() { printf foo; fn2; };
fn2() { printf bar; fn3; };
fn3() { printf baz\\n; };
trap fn RETURN; fn'
foobarbaz
foobarbaz
foobarbaz
foobarbaz
(I'd expect one 'foobarbaz', not four)
It seems odd that the RETURN trap would be triggered while a RETURN trap
action is still being executed. Might it be better to temporarily
deactivate the effect of '-o functrace' while a RETURN trap action is
being executed?
Thanks,
- M.
[BUG] RETURN trap with -o functrace: infinite recursion on 'eval return' ,
Martijn Dekker <=