Fix infinite loop on obsolete function aliases#368
Open
kovan wants to merge 2 commits intoWilfred:masterfrom
Open
Fix infinite loop on obsolete function aliases#368kovan wants to merge 2 commits intoWilfred:masterfrom
kovan wants to merge 2 commits intoWilfred:masterfrom
Conversation
When helpful-callable is called on a symbol defined via define-obsolete-function-alias, the alias chain can be cyclic or point to a void function. This caused hangs because: - find-function-library (Emacs built-in) has its own alias-following loop without cycle detection, causing 100% CPU on cyclic aliases - indirect-function calls could hang on cycles in older Emacs versions or error on void targets - helpful--canonical-symbol called symbol-function without checking fboundp, crashing on void alias targets Add helpful--safe-indirect-function that resolves function indirection with cycle detection, depth limiting, and void-function handling. Use it to replace bare indirect-function calls in helpful--edebug-p, helpful--primitive-p, and helpful--source. Guard the find-function-library call with a cycle check to prevent infinite loops in the Emacs built-in code. Fix: Wilfred#365 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #365 —
helpful-callablehangs at 100% CPU on obsolete aliases due to missing cycle detection inindirect-functionandfind-function-librarycalls.Adds
helpful--safe-indirect-functionwith cycle detection (seen-list), depth limiting (max 10), andcondition-caseforvoid-function/cyclic-function-indirection. Updated 5 call sites.Verified on Emacs 30.2: void alias returns nil safely; cycle detection, depth limit, and condition-case all confirmed present.