Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

More useful variable tracing



On Tue, 12 Mar 2013 20:17:38 -0400
Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> On 2013-03-12 at 18:08 -0400, James Jong wrote:
> > Why are these paths added to $PATH? Any pointers on what I can look at?
> 
> tcsh> zsh -x
> 
> If you do that, and also capture stderr to a file, and immediately quit,
> then you can grep the stderr output for references to PATH or path.
> Ignore fpath, module_path, manpath, etc etc.
> 
> This should get rid of most of the cruft:
> % pcregrep -n '\b(?i)path\b' zsh.trace
> 
> Use the line-numbers to find the matches in the full output and trace
> back where the lines come from.

Off the wall aside, vaguely related to Bart's point about tracing array
subscripts: I've had the growing suspicion we ought to be able to do a
lot better than this with only moderate effort.  Tracing setting of
variables is a particularly common thing to do.  It would be good to
come up with something that can be set on the command line that can
cause tracing of a given set of variables (so whatever we did would need
to take effect before initialisation files but not otherwise affect the
start sequence).  It might take a while to find all the places
internally that need to check, but the code shouldn't actually be that
hard.

Maybe there's something more sophisticated we can do involving pattern
matching on xtrace output, but I suspect that's just making it harder to
trap the common cases.

pws



Messages sorted by: Reverse Date, Date, Thread, Author