-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
main: Fix alias loops in nested lists (e.g. command substitution) #796
base: master
Are you sure you want to change the base?
Conversation
|
||
BUFFER='ls' | ||
|
||
expected_region_highlight=( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mention that this test will crash zsh (infinite recursion, presumably?) if the bug being tested for is present?
What about the opposite problem? Might some $seen_alias element remain set longer than it should? |
I can't imagine a scenario in which an alias is being expanded and in the course of expansion it is again eligible for expansion. That way lies madness^Wstack overflows. |
The C code enforces that an alias be ineligible for expansion whilst it's being expanded. It's easy to see that: |
I don't immediately follow how that's the same thing as what I asked, though. I'll look again later. |
Seems The point being the only way for seen_alias to be set longer than it ought is if an alias is eligible for expansion while it is itself being expanded. That seems to only be the case with |
That answers my question, then. I don't have any other review comments. Would you report the segfault, please? Either upstream or here, whichever's appropriate. Thanks! |
I don't get a segfault. Both with and without z-sy-h, I get this:
% alias ls='eval ls'
% ls
zsh: job table full or recursion limit exceeded
I did press <Enter> at the end of the second line.
|
I don't get a segfault. Both with and without z-sy-h, I get this:
% alias ls='eval ls'
% ls
zsh: job table full or recursion limit exceeded
With PRINT_EXIT_VALUE in effect too, I see exactly 999 copies of "zsh: exit 1" printed.
That looks like it might be MAX_MAXJOBS: https://github.com/zsh-users/zsh/blob/5ede2c55f144593c16498c3131a76e188114a9c6/Src/jobs.c#L2061-L2066
|
Should this be milestoned 0.8.0? |
alias ls='echo $(ls)'
thenls
will cause zsh to crash. This avoids that.The idea is that we are still in the alias even when recursing into a nested list like a command substitution, so _highlight_list is the wrong place to local seen_alias.