On 6/2/16 9:20 AM, Paulo César Pereira de Andrade wrote: > Hi, > > This is a "RFC" to update documentation to better match behavior, > or, to get some information about shell tracing. > > Bellow I am quoting a request from an user: > > ---8<--- > The bash shell offers the xtrace (set -x), functrace (set -T) and > function trace (typeset -ft) facilities to control script and function > tracing yet it appears that only set -x is effective, tracing the > calling script + any and all called functions.
The problem is faulty assumptions, leading to an incorrect conclusion. Execution tracing uses `set -x, global shell function tracing is `set -T', and `typeset -ft' turns on function tracing for an individual function. The mistake is assuming that function tracing and execution tracing are the same thing. They're not. Function tracing exists primarily for use by the shell's debugging mode, which implements execution tracing and breakpoints using the DEBUG trap; the manual says: "Traced functions inherit the DEBUG and RETURN traps from the calling shell." and "-T If set, any traps on DEBUG and RETURN are inherited by shell functions, command substitutions, and commands executed in a subshell environment. The DEBUG and RETURN traps are normally not inherited in such cases." The rest of the proposal assumes some other meaning for `function tracing' than what exists in bash. This special meaning for -t when used with -f and shell function names could possibly appear in some future version of bash, using another option letter, but it won't happen until at least bash-5.0, if ever. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, ITS, CWRU c...@case.edu http://cnswww.cns.cwru.edu/~chet/