]> git.eshelyaron.com Git - emacs.git/commitdiff
Don't recurse in erc-server-delayed-check-reconnect
authorF. Jason Park <jp@neverwas.me>
Tue, 28 May 2024 07:32:13 +0000 (00:32 -0700)
committerEshel Yaron <me@eshelyaron.com>
Thu, 6 Jun 2024 10:25:14 +0000 (12:25 +0200)
* lisp/erc/erc-backend.el (erc-server-delayed-check-reconnect): Run
`reschedule' function on a timer to avoid growing the stack when
calling `delete-process'.
* lisp/erc/erc-common.el (erc--favor-changed-reverted-modules-state):
Fix `pcase' condition so that changing an option to its standard value
does not earn a "STANDARD" label in Customize if that value differs
from the saved one.
* lisp/erc/erc.el (erc-open-socks-tls-stream): Reword doc string.
* test/lisp/erc/erc-tests.el (erc--with-dependent-type-match)
(erc--with-dependent-type-match): Remove useless tests (bug#71178).
* test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld:
Await phantom EOFs and PINGs to somewhat account for a race that can
result in a failure when running the suite in parallel with -jN.
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common--print-trace): Set `debug-on-error' to t
so that errors in timers always trigger test failures.
;; * test/lisp/erc/resources/base/assoc/reconplay/foonet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/base/upstream-reconnect/soju-barnet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/base/mask-target-routing/foonet.eld:
;; Timeouts.
;; * test/lisp/erc/resources/join/network-id/barnet.eld: Timeout.

(cherry picked from commit 50b134c4dc828485705a0a5b5a884379ff25bb15)

lisp/erc/erc-backend.el
lisp/erc/erc-common.el
lisp/erc/erc.el
test/lisp/erc/erc-tests.el
test/lisp/erc/resources/base/assoc/reconplay/foonet.eld
test/lisp/erc/resources/base/mask-target-routing/foonet.eld
test/lisp/erc/resources/base/reconnect/unexpected-disconnect.eld
test/lisp/erc/resources/base/upstream-reconnect/soju-barnet.eld
test/lisp/erc/resources/erc-scenarios-common.el
test/lisp/erc/resources/join/network-id/barnet.eld

index a1f84ee5165aa7cc6686cca2dcc4876d6f13eabc..e2b7c0b6f489262275dcb627640471e9a814abb7 100644 (file)
@@ -885,7 +885,7 @@ Expect BUFFER to be the server buffer for the current connection."
                                                  (time-convert nil 'integer))))
                            ((or "connection broken by remote peer\n"
                                 (rx bot "failed"))
-                            (funcall reschedule proc)))))
+                            (run-at-time nil nil reschedule proc)))))
              (filter (lambda (proc _)
                        (delete-process proc)
                        (with-current-buffer buffer
index 4ba7990ab98504c481c9c64302f70b736cd25e8d..3577e697515019bef8d73ebcb693d8900a3f5b43 100644 (file)
@@ -191,7 +191,7 @@ widget runs its set function.")
   "Be more nuanced in displaying Custom state of `erc-modules'.
 When `customized-value' differs from `saved-value', allow widget
 to behave normally and show \"SET for current session\", as
-though `customize-set-variable' or similar had been applied.
+though `customize-set-variable' or similar has been applied.
 However, when `customized-value' and `standard-value' match but
 differ from `saved-value', prefer showing \"CHANGED outside
 Customize\" to prevent the widget from seeing a `standard'
@@ -207,7 +207,7 @@ instead of a `set' state, which precludes any actual saving."
   (funcall (get 'erc-modules 'custom-set) 'erc-modules
            (funcall op (erc--normalize-module-symbol name) erc-modules))
   (when (equal (pcase (get 'erc-modules 'saved-value)
-                 (`((quote ,saved) saved)))
+                 (`((quote ,saved)) saved))
                erc-modules)
     (customize-mark-as-set 'erc-modules)))
 
index d22fce1634f94621c5cbe707d2ac591d673511e1..3f43c3344929959a647650da49271b847dcdfaba 100644 (file)
@@ -2951,15 +2951,16 @@ PARAMETERS should be a sequence of keywords and values, per
 
 (defun erc-open-socks-tls-stream (name buffer host service &rest parameters)
   "Connect to an IRC server via SOCKS proxy over TLS.
-Defer to the `socks' and `gnutls' libraries to make the actual
-connection and perform TLS negotiation.  Expect SERVICE to be a
-TLS port number and that the plist PARAMETERS contains a
-`:client-certificate' pair when necessary.  Otherwise, assume the
-arguments NAME, BUFFER, and HOST to be acceptable to
-`open-network-stream' and that users know to check out
-`erc-server-connect-function' and Info node `(erc) SOCKS' for
-more info, including an important example of how to \"wrap\" this
-function with SOCKS credentials."
+Perform the duties required of an `erc-server-connect-function'
+implementer, and return a network process.  Defer to the `socks'
+and `gnutls' libraries to make the connection and handle TLS
+negotiation.  Expect SERVICE to be a TLS port number and
+PARAMETERS to be a possibly empty plist containing items like a
+`:client-certificate' pair.  Pass NAME, BUFFER, and HOST directly
+to `open-network-stream'.  Beyond that, operate as described in
+Info node `(erc) SOCKS', and expect users to \"wrap\" this
+function with `let'-bound credentials when necessary, as shown in
+the example."
   (require 'gnutls)
   (require 'socks)
   (let ((proc (socks-open-network-stream name buffer host service))
index f393402fe816336a18c362f3d1d8c0a056ffb50b..f4cff06f942d86154c5e55ac3393f576f9c0d05a 100644 (file)
 
     (advice-remove 'buffer-local-value 'erc-with-server-buffer)))
 
-(ert-deftest erc--with-dependent-type-match ()
-  (should (equal (macroexpand-1
-                  '(erc--with-dependent-type-match (repeat face) erc-match))
-                 '(backquote-list*
-                   'repeat :match (lambda (w v)
-                                    (require 'erc-match)
-                                    (widget-editable-list-match w v))
-                   '(face)))))
-
 (ert-deftest erc--doarray ()
   (let ((array "abcdefg")
         out)
       (should-not (erc--valid-local-channel-p "#chan"))
       (should (erc--valid-local-channel-p "&local")))))
 
-;; FIXME remove this because it serves no purpose.  See bug#71178.
-(ert-deftest erc--restore-initialize-priors ()
-  (unless (>= emacs-major-version 28)
-    (ert-skip "Lisp nesting exceeds `max-lisp-eval-depth'"))
-  (should (pcase (macroexpand-1 '(erc--restore-initialize-priors erc-my-mode
-                                   foo (ignore 1 2 3)
-                                   bar #'spam
-                                   baz nil))
-            (`(let* ((,p (or erc--server-reconnecting erc--target-priors))
-                     (,q (and ,p (alist-get 'erc-my-mode ,p))))
-                (unless (local-variable-if-set-p 'erc-my-mode)
-                  (error "Not a local minor mode var: %s" 'erc-my-mode))
-                (setq foo (if ,q (alist-get 'foo ,p) (ignore 1 2 3))
-                      bar (if ,q (alist-get 'bar ,p) #'spam)
-                      baz (if ,q (alist-get 'baz ,p) nil)))
-             t))))
-
 (ert-deftest erc--target-from-string ()
   (should (equal (erc--target-from-string "#chan")
                  #s(erc--target-channel "#chan" \#chan nil)))
index 15bcca2a623730428fb8fe9ef33efe5e8f85de7d..78697d6f2c9e2cfc98e1756c05be2302836fa0e4 100644 (file)
@@ -33,7 +33,7 @@
  (0.0 ":***!znc@znc.in PRIVMSG #chan :Playback Complete.")
  (0.0 ":irc.foonet.org 305 tester :You are no longer marked as being away"))
 
-((mode 3 "MODE #chan")
+((mode-chan 10 "MODE #chan")
  (1.0 ":irc.foonet.org 324 tester #chan +nt")
  (0.0 ":irc.foonet.org 329 tester #chan 1623816901")
  (0.1 ":alice!~u@mw6kegwt77kwe.irc PRIVMSG #chan :bob: At thy good heart's oppression.")
index 796d5566b658fb940493a0c341ce4aee9e7950c3..7b5796129f7038414e225f9911039c6cf258ec6b 100644 (file)
@@ -17,7 +17,7 @@
  (0 ":irc.foonet.org 266 tester 4 4 :Current global users 4, max 4")
  (0 ":irc.foonet.org 422 tester :MOTD File is missing"))
 
-((mode-user 1.2 "MODE tester +i")
+((mode-user 10 "MODE tester +i")
  ;; No mode answer
  (0 ":irc.znc.in 306 tester :You have been marked as being away")
  (0 ":tester!~u@gq7yjr7gsu7nn.irc JOIN #foo")
index 386d0f4b085c18cd0d0e509c7fc085031403c49f..80903f9415537fe9095202e4560b9d4ffe2200be 100644 (file)
@@ -1,4 +1,8 @@
 ;; -*- mode: lisp-data; -*-
+
+((~eof 60 EOF))
+((~ping 60 "PING"))
+
 ((nick 10 "NICK tester"))
 ((user 10 "USER user 0 * :tester")
  (0 ":irc.foonet.org 001 tester :Welcome to the foonet IRC Network tester")
index 3711eb8f8e654f5eaf102186b358b8a4423ae382..4b7db5a91b1d87660c78b4035c47c574e00eb4ab 100644 (file)
  (0.22 ":soju.im 221 tester +Zi")
  (0.00 ":soju.im 422 tester :Use /motd to read the message of the day"))
 
-((mode 5 "MODE tester +i")
+((mode-tester 5 "MODE tester +i")
  (0.00 ":tester!tester@10.0.2.100 JOIN #chan")
  (0.06 ":soju.im 353 tester = #chan :tester @mike joe")
  (0.01 ":soju.im 366 tester #chan :End of /NAMES list")
  (0.23 ":irc.barnet.org 221 tester +Zi"))
 
-((mode 5 "MODE #chan")
+((mode-chan-a 5 "MODE #chan")
  (0.00 ":soju.im 324 tester #chan +tn")
  (0.01 ":soju.im 329 tester #chan 1652878846")
  (0.01 ":joe!~u@6d9pasqcqwb2s.irc PRIVMSG #chan :mike: There is five in the first show.")
@@ -49,7 +49,7 @@
  ;; Server-initialed join
  (0.01 ":tester!tester@10.0.2.100 JOIN #chan"))
 
-((mode 5 "MODE #chan")
+((mode-chan-b 5 "MODE #chan")
  (0.22 ":soju.im 353 tester = #chan :@mike joe tester")
  (0.00 ":soju.im 366 tester #chan :End of /NAMES list")
  (0.00 ":soju.im 324 tester #chan +nt")
index c7d5c9d6677e4115b97819fee11a15570e5360c4..0dc82c98d5fb92e241ece6f114b244fde8285a0e 100644 (file)
                          (quit . ,(erc-quit/part-reason-default))
                          (erc-version . ,erc-version)))
       (erc-modules (copy-sequence erc-modules))
+      (debug-on-error t)
       (inhibit-interaction noninteractive)
       (auth-source-do-cache nil)
       (timer-list (copy-sequence timer-list))
index ad6a7c820a9502137b3837184af705329f2e76be..3d13c7a6296178f04b3d80da8b47251bbc4e3fa0 100644 (file)
@@ -1,5 +1,5 @@
 ;; -*- mode: lisp-data; -*-
-((pass 2 "PASS :barnet:changeme"))
+((pass 10 "PASS :barnet:changeme"))
 ((nick 2 "NICK tester"))
 ((user 1 "USER user 0 * :tester")
  (0 ":irc.barnet.org 001 tester :Welcome to the barnet IRC Network tester")