-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
🐛 Setting $PAGER to use delta results in an infinite loop #529
Comments
Hi @zachriggle I'm not saying your suggestion to protect against this is a bad one, but, you intended to use We can do what you suggest. Incidentally, with lines, it seems that a newline / prompt display makes a difference? (this is zsh on macos but my bash behaves similarly albeit with
|
It was set intentionally, but I had forgotten that Diagnosing the issue took a long while, so it would be nice to have protection against it. It could work even if In any case, I did end up using |
OK, thanks, let's do it then! (It has been raised once before so this seems fairly clearly justified). Let me know if you'd like to make the PR, otherwise I can. |
My employer forbids FOSS contributions so unfortunately I cannot add a PR
On Tue, Mar 2, 2021 at 3:48 PM Dan Davison ***@***.***> wrote:
OK, thanks, let's do it then! (It has been raised once before so this
seems fairly clearly justified). Let me know if you'd like to make the PR,
otherwise I can.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#529 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAA3IGBD6527AX7PQAJNPZTTBVFI5ANCNFSM4YOKLODQ>
.
--
*Zach Riggle*
|
Ah right, I think I remember that from before. No problem, done in #531 (to be included in next release). |
It looks like we wend up in an infinite fork/exec loop if you do the following.
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 beos.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 anotherdelta
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
, likePAGER
, are important and should not be used for holding random variables!The text was updated successfully, but these errors were encountered: