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

Re: Idea: automatic dotfiles bisection (and minimal example extraction)

On Dec 25,  2:51pm, Daniel Shahaf wrote:
} I was thinking, we could write an automatic bisector, similar to
} git-bisect(1), which operates on zshenv,zprofile,zshrc, and
} automatically reports which statement in those files causes the problem.

Assorted thoughts:

A place to start might be https://github.com/rocky/zshdb

git-bisect works because it has the git revision history to play with.
Trying to apply that within a single revision of a structured file may
be more trouble than the binary search is worth.

Most difficult is if the error appears inside a multi-line construct,
in which case you have to retain e.g the "done" or "else"/"fi" for
the whole thing to remain valid.  Certain "bisects" would end up
having to have overlapping start/end to be parseable.

So if this is going to be automated anyway, it might be better to
just do it brute force -- start at the end of the file, delete one
statement, if the error is still there put that one back and delete
the one above it, repeat.

For init-file debugging in particular, it might be possible to get a
long way by using a carefully designed PS4, capturing the output of
a full pass through the init file with xtrace, and then examining
that to find line numbers for where to make a clean break.

You're still going to run into trouble if the problem is because of
an option setting where the user has planted a whole list of options
in a single call to "setopt".

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