emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/relint 8eb4f9dba0: Don't recurse infinitely when proces


From: ELPA Syncer
Subject: [elpa] externals/relint 8eb4f9dba0: Don't recurse infinitely when processing recursive defalias
Date: Sun, 23 Jan 2022 04:57:56 -0500 (EST)

branch: externals/relint
commit 8eb4f9dba0f78cf213c9ea849cc1e8a4b5799145
Author: Mattias EngdegÄrd <mattiase@acm.org>
Commit: Mattias EngdegÄrd <mattiase@acm.org>

    Don't recurse infinitely when processing recursive defalias
    
    This would occur for
    
    (defalias 'tata #'(lambda () ... (tata)))
    
    so we just require the definiens of defalias to be a (quoted) symbol.
---
 relint.el    | 6 +++++-
 test/5.elisp | 5 +++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/relint.el b/relint.el
index 4c5e8ed0c5..2967d6b9fd 100644
--- a/relint.el
+++ b/relint.el
@@ -1679,7 +1679,11 @@ than just to a surrounding or producing expression."
              (when indices
                (push (cons name (reverse indices))
                      relint--regexp-functions)))))))
-    (`(defalias ,name-arg ,def-arg . ,_)
+    (`(defalias ,name-arg ,(and def-arg
+                                `(,(or 'quote 'function) ,(pred symbolp)))
+        . ,_)
+     ;; Only store and follow aliases on the form (quote SYMBOL) or
+     ;; (function SYMBOL), to avoid infinite recursion.
      (let ((name (relint--eval-or-nil name-arg))
            (def  (relint--eval-or-nil def-arg)))
        (when (and name def)
diff --git a/test/5.elisp b/test/5.elisp
index eb0e78c5a8..b18490efa8 100644
--- a/test/5.elisp
+++ b/test/5.elisp
@@ -73,3 +73,8 @@
 
 (defun test-prog2 ()
   (looking-at (prog2 "a" "[VV]" "b" "c")))
+
+;; Make sure we don't enter infinite recursion when checking this one.
+(defalias 'test-recursive
+  #'(lambda (x)
+      (if x (test-recursive (cdr x)) 'ok)))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]