$ 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.

Reply via email to