From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#53632: Function definition history Date: Fri, 04 Feb 2022 11:30:26 -0500 Message-ID: References: <87y22spdxo.fsf@gmx.de> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14468"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Glenn Morris , 53632@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Feb 04 17:41:07 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nG1dy-0003ag-WE for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Feb 2022 17:41:07 +0100 Original-Received: from localhost ([::1]:47068 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nG1dx-0001dB-Te for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 04 Feb 2022 11:41:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:47920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nG1UW-0003Jd-5m for bug-gnu-emacs@gnu.org; Fri, 04 Feb 2022 11:31:20 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:38778) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nG1UE-0007Hf-IB for bug-gnu-emacs@gnu.org; Fri, 04 Feb 2022 11:31:19 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nG1UE-00029w-9Z for bug-gnu-emacs@gnu.org; Fri, 04 Feb 2022 11:31:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 04 Feb 2022 16:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 53632 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 53632-submit@debbugs.gnu.org id=B53632.16439922428274 (code B ref 53632); Fri, 04 Feb 2022 16:31:02 +0000 Original-Received: (at 53632) by debbugs.gnu.org; 4 Feb 2022 16:30:42 +0000 Original-Received: from localhost ([127.0.0.1]:60908 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nG1Tt-00029O-Rs for submit@debbugs.gnu.org; Fri, 04 Feb 2022 11:30:42 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:55338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nG1Ts-00029A-Co for 53632@debbugs.gnu.org; Fri, 04 Feb 2022 11:30:40 -0500 Original-Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 5C62480521; Fri, 4 Feb 2022 11:30:34 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7B33B80306; Fri, 4 Feb 2022 11:30:32 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1643992232; bh=BhKzEOhlGFc0RmY3oDSLJcjzT6dcXFmZ4dTe+c2iKYg=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=gOMFBkTsvjBiKZcEGzBFhAXvFTj5kR7iy0WnjmCZ9WqbzYHfagWqBhAKPTYfY/K8c INk0LbQp50JtLTehFuu/7wzp1h/k8Akcu6lW15AwXJFvNJ4J9jQ9Aqe8Af6opeuu0N sgiMmy998CSPtcRED9pRnfYDiU07aVW+x0XICwAhSqCVkdLdWZa3VRmJF6jBcKjroc Hz2LBqjBYGNBcIppAlyJCNjbTQPFSmL47t/XnSlL8de52uydCPnGprtX5eDBIZfcBJ F7r/EWIzdA/wsAQ6sswHRP0j8Ty8UoSMmxgyenXH+XK1NUr386ULWKKvXrCKFd1Rdg dAjkLAtxtTdLA== Original-Received: from pastel (76-10-138-212.dsl.teksavvy.com [76.10.138.212]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 50887120709; Fri, 4 Feb 2022 11:30:32 -0500 (EST) In-Reply-To: <87y22spdxo.fsf@gmx.de> (Michael Albinus's message of "Thu, 03 Feb 2022 09:11:31 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:226007 Archived-At: > Now, this behavior has changed. With the same recipe, we get > > --8<---------------cut here---------------start------------->8--- > => > tramp-unload-file-name-handlers > tramp-unload-tramp > tramp-register-archive-file-name-handler > tramp-archive-autoload-file-name-handler > tramp-register-autoload-file-name-handlers > tramp-autoload-file-name-handler > --8<---------------cut here---------------end--------------->8--- Indeed, the behavior is changed, but AFAICT it's "better" in that it gives us a state closer to the one we had before `tramp.el` was loaded: the above functions are predefined in `loaddefs.el` via `;;;###autoload` cookies, so it's normal that they're defined when `tramp` is not loaded. So I think the problem is in the test rather than in the unload code. The patch below fixes the test for me. BTW, I notice that the test uses `functionp` so it doesn't pay attention to whether macros are properly unloaded (I noticed because I thought it was odd that the above list didn't include `tramp-archive-autoload-file-name-regexp` which is similarly predefined in `loaddefs.el`). Stefan diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index b41824a6cf3..1f9eea4c5f7 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -202,8 +202,8 @@ tramp--test-instrument-test-case (trace-buffer (tramp-trace-buffer-name tramp-test-vec)) (debug-ignored-errors (append - '("^make-symbolic-link not supported$" - "^error with add-name-to-file") + '("\\`make-symbolic-link not supported\\'" + "\\`error with add-name-to-file") debug-ignored-errors)) inhibit-message) (unwind-protect @@ -326,7 +326,7 @@ tramp-test01-file-name-syntax (let (tramp-mode) (should-not (tramp-tramp-file-p "/method:user@host:"))) ;; `tramp-ignored-file-name-regexp' suppresses Tramp. - (let ((tramp-ignored-file-name-regexp "^/method:user@host:")) + (let ((tramp-ignored-file-name-regexp "\\`/method:user@host:")) (should-not (tramp-tramp-file-p "/method:user@host:"))) ;; Methods shall be at least two characters on MS Windows, ;; except the default method. @@ -3664,7 +3664,7 @@ tramp--test-ignore-add-name-to-file-error `(condition-case err (progn ,@body) (file-error - (unless (string-match-p "^error with add-name-to-file" + (unless (string-match-p "\\`error with add-name-to-file" (error-message-string err)) (signal (car err) (cdr err)))))) @@ -6070,7 +6070,7 @@ tramp-test39-detect-external-change (when create-lockfiles (should (string-match-p (format - "^%s changed on disk; really edit the buffer\\?" + "\\`%s changed on disk; really edit the buffer\\?" (if (tramp--test-crypt-p) ".+" (file-name-nondirectory tmp-name))) captured-messages)) @@ -6183,7 +6183,7 @@ tramp--test-ftp-p This does not support globbing characters in file names (yet)." ;; Globbing characters are ??, ?* and ?\[. (string-match-p - "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))) + "ftp\\'" (file-remote-p tramp-test-temporary-file-directory 'method))) (defun tramp--test-fuse-p () "Check, whether an FUSE file system isused." @@ -6215,7 +6215,7 @@ tramp--test-ksh-p ;; We must refill the cache. `file-truename' does it. (file-truename tramp-test-temporary-file-directory) (string-match-p - "ksh$" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) + "ksh\\'" (tramp-get-connection-property tramp-test-vec "remote-shell" ""))) (defun tramp--test-macos-p () "Check, whether the remote host runs macOS." @@ -6263,7 +6263,7 @@ tramp--test-share-p "Check, whether the method needs a share." (and (tramp--test-gvfs-p) (string-match-p - "^\\(afp\\|davs?\\|smb\\)$" + "\\`\\(afp\\|davs?\\|smb\\)\\'" (file-remote-p tramp-test-temporary-file-directory 'method)))) (defun tramp--test-sshfs-p () @@ -7206,11 +7206,20 @@ tramp-test47-unload (lambda (x) (and (or (and (boundp x) (null (local-variable-if-set-p x))) (and (functionp x) (null (autoloadp (symbol-function x))))) - (string-match-p "^tramp" (symbol-name x)) + (string-match-p "\\`tramp" (symbol-name x)) ;; `tramp-completion-mode' is autoloaded in Emacs < 28.1. (not (eq 'tramp-completion-mode x)) - (not (string-match-p "^tramp\\(-archive\\)?--?test" (symbol-name x))) - (not (string-match-p "unload-hook$" (symbol-name x))) + ;; Some functions aren't autoloads but they are similarly + ;; predefined before `Tramp' is loaded (bug#53632): + (not (memq x '(tramp-unload-file-name-handlers + tramp-unload-tramp + tramp-register-archive-file-name-handler + tramp-archive-autoload-file-name-handler + tramp-register-autoload-file-name-handlers + tramp-autoload-file-name-handler))) + (not (string-match-p "\\`tramp\\(-archive\\)?--?test" + (symbol-name x))) + (not (string-match-p "unload-hook\\'" (symbol-name x))) (ert-fail (format "`%s' still bound" x))))) ;; The defstruct `tramp-file-name' and all its internal functions ;; shall be purged. @@ -7225,8 +7234,8 @@ tramp-test47-unload (mapatoms (lambda (x) (and (boundp x) - (string-match-p "-\\(hook\\|function\\)s?$" (symbol-name x)) - (not (string-match-p "unload-hook$" (symbol-name x))) + (string-match-p "-\\(hook\\|function\\)s?\\'" (symbol-name x)) + (not (string-match-p "unload-hook\\'" (symbol-name x))) (consp (symbol-value x)) (ignore-errors (all-completions "tramp" (symbol-value x))) (ert-fail (format "Hook `%s' still contains Tramp function" x)))))) @@ -7237,7 +7246,7 @@ tramp-test-all (interactive "p") (funcall (if interactive #'ert-run-tests-interactively #'ert-run-tests-batch) - "^tramp")) + "\\`tramp")) ;; TODO: