-
Notifications
You must be signed in to change notification settings - Fork 444
Description
It looks like we wend up in an infinite fork/exec loop if you do the following.
$ export PAGER='delta -n'
$ git -c core.pager='delta -n' log -p
Because delta
itself is trying to invoke the $PAGER
to paginate its own output.
delta
should detect this situation (e.g. in Python it would be os.environ.get('PAGER', '').startswith('delta ')
and emit an error message in this case.
Otherwise, it's just an infinite hang and all CPU cores spinning as each delta
process tries to spawn yet another delta
process.
I discovered this while using $PAGER
within a script to be what I would set Git's pager to, and it turns out that this error cropped up because of the specific choice of my variable name.
Similar gotchas with shell scripting happen with other important, magic variables, e.g. $LINES
is the number of lines in your terminal and cannot be overridden. LINES
, like PAGER
, are important and should not be used for holding random variables!
$ echo $LINES
47
$ LINES=1
$ echo $LINES
47