aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPo Lu2023-05-05 08:27:30 +0800
committerPo Lu2023-05-05 08:27:30 +0800
commitdaccdf7e6d4bc42ffe8ffbc9db137bd44b073343 (patch)
treeeb0768a48d25a1bd7fdfaed69bbfcd78fa8efd00
parentccef1ff072ef0eaac085aeffc7321dcf1fae2f0f (diff)
parent34ac7d908762663e4f91b678d3456286c494c237 (diff)
downloademacs-daccdf7e6d4bc42ffe8ffbc9db137bd44b073343.tar.gz
emacs-daccdf7e6d4bc42ffe8ffbc9db137bd44b073343.zip
Merge remote-tracking branch 'origin/master' into feature/android
-rwxr-xr-xbuild-aux/git-hooks/post-commit4
-rwxr-xr-xbuild-aux/git-hooks/pre-push4
-rw-r--r--lisp/net/tramp-cache.el12
-rw-r--r--lisp/net/tramp-compat.el12
-rw-r--r--lisp/net/tramp.el45
-rw-r--r--lisp/vc/vc-hg.el2
-rw-r--r--test/lisp/net/tramp-tests.el39
7 files changed, 68 insertions, 50 deletions
diff --git a/build-aux/git-hooks/post-commit b/build-aux/git-hooks/post-commit
index 05f2d778b5c..10f43b539ac 100755
--- a/build-aux/git-hooks/post-commit
+++ b/build-aux/git-hooks/post-commit
@@ -34,6 +34,8 @@
34 34
35### Code: 35### Code:
36 36
37HOOKS_DIR=$(dirname $0)
38
37# Prefer gawk if available, as it handles NUL bytes properly. 39# Prefer gawk if available, as it handles NUL bytes properly.
38if type gawk >/dev/null 2>&1; then 40if type gawk >/dev/null 2>&1; then
39 awk="gawk" 41 awk="gawk"
@@ -42,4 +44,4 @@ else
42fi 44fi
43 45
44git rev-parse HEAD | $awk -v reason=post-commit \ 46git rev-parse HEAD | $awk -v reason=post-commit \
45 -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk 47 -f $HOOKS_DIR/commit-msg-files.awk
diff --git a/build-aux/git-hooks/pre-push b/build-aux/git-hooks/pre-push
index 6ff59102fd7..8d5dde2bbaf 100755
--- a/build-aux/git-hooks/pre-push
+++ b/build-aux/git-hooks/pre-push
@@ -31,6 +31,8 @@
31 31
32### Code: 32### Code:
33 33
34HOOKS_DIR=$(dirname $0)
35
34# Prefer gawk if available, as it handles NUL bytes properly. 36# Prefer gawk if available, as it handles NUL bytes properly.
35if type gawk >/dev/null 2>&1; then 37if type gawk >/dev/null 2>&1; then
36 awk="gawk" 38 awk="gawk"
@@ -83,4 +85,4 @@ $awk -v origin_name="$1" '
83 # Print every SHA after oldref, up to (and including) newref. 85 # Print every SHA after oldref, up to (and including) newref.
84 system("git rev-list --first-parent --reverse " oldref ".." newref) 86 system("git rev-list --first-parent --reverse " oldref ".." newref)
85 } 87 }
86' | $awk -v reason=pre-push -f ${GIT_DIR:-.git}/hooks/commit-msg-files.awk 88' | $awk -v reason=pre-push -f $HOOKS_DIR/commit-msg-files.awk
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index c5864e7fa5e..e0d38853956 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -496,12 +496,12 @@ PROPERTIES is a list of file properties (strings)."
496 (cons property (gethash property hash tramp-cache-undefined))) 496 (cons property (gethash property hash tramp-cache-undefined)))
497 ,properties))) 497 ,properties)))
498 (unwind-protect (progn ,@body) 498 (unwind-protect (progn ,@body)
499 ;; Reset PROPERTIES. Recompute hash, it could have been flushed. 499 ;; Reset PROPERTIES. Recompute hash, it could have been flushed.
500 (setq hash (tramp-get-hash-table ,key)) 500 (setq hash (tramp-get-hash-table ,key))
501 (dolist (value values) 501 (dolist (value values)
502 (if (not (eq (cdr value) tramp-cache-undefined)) 502 (if (not (eq (cdr value) tramp-cache-undefined))
503 (puthash (car value) (cdr value) hash) 503 (puthash (car value) (cdr value) hash)
504 (remhash (car value) hash))))))) 504 (remhash (car value) hash)))))))
505 505
506;;;###tramp-autoload 506;;;###tramp-autoload
507(defun tramp-cache-print (table) 507(defun tramp-cache-print (table)
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 150c3fbf187..43544ae327e 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -35,6 +35,7 @@
35(require 'parse-time) 35(require 'parse-time)
36(require 'shell) 36(require 'shell)
37(require 'subr-x) 37(require 'subr-x)
38(require 'xdg)
38 39
39(declare-function tramp-error "tramp") 40(declare-function tramp-error "tramp")
40(declare-function tramp-tramp-file-p "tramp") 41(declare-function tramp-tramp-file-p "tramp")
@@ -64,9 +65,16 @@
64 (with-no-warnings (funcall ,function ,@arguments)))) 65 (with-no-warnings (funcall ,function ,@arguments))))
65 66
66;; We must use a local directory. If it is remote, we could run into 67;; We must use a local directory. If it is remote, we could run into
67;; an infloop. 68;; an infloop. We try to follow the XDG specification, for security reasons.
68(defconst tramp-compat-temporary-file-directory 69(defconst tramp-compat-temporary-file-directory
69 (eval (car (get 'temporary-file-directory 'standard-value)) t) 70 (file-name-as-directory
71 (if-let ((xdg (xdg-cache-home))
72 ((file-directory-p xdg))
73 ((file-writable-p xdg)))
74 ;; We can use `file-name-concat' starting with Emacs 28.1.
75 (prog1 (setq xdg (concat (file-name-as-directory xdg) "emacs"))
76 (make-directory xdg t))
77 (eval (car (get 'temporary-file-directory 'standard-value)) t)))
70 "The default value of `temporary-file-directory'.") 78 "The default value of `temporary-file-directory'.")
71 79
72(defsubst tramp-compat-make-temp-name () 80(defsubst tramp-compat-make-temp-name ()
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 7ce984d9144..3eb2dd13cbc 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -120,7 +120,7 @@ Any level x includes messages for all levels 1 .. x-1. The levels are
120(defcustom tramp-debug-to-file nil 120(defcustom tramp-debug-to-file nil
121 "Whether Tramp debug messages shall be saved to file. 121 "Whether Tramp debug messages shall be saved to file.
122The debug file has the same name as the debug buffer, written to 122The debug file has the same name as the debug buffer, written to
123`temporary-file-directory'." 123`tramp-compat-temporary-file-directory'."
124 :version "28.1" 124 :version "28.1"
125 :type 'boolean) 125 :type 'boolean)
126 126
@@ -665,6 +665,7 @@ The `sudo' program appears to insert a `^@' character into the prompt."
665 "Sorry, try again." 665 "Sorry, try again."
666 "Name or service not known" 666 "Name or service not known"
667 "Host key verification failed." 667 "Host key verification failed."
668 "Authentication failed"
668 "No supported authentication methods left to try!" 669 "No supported authentication methods left to try!"
669 (: "Login " (| "Incorrect" "incorrect")) 670 (: "Login " (| "Incorrect" "incorrect"))
670 (: "Connection " (| "refused" "closed")) 671 (: "Connection " (| "refused" "closed"))
@@ -1970,7 +1971,7 @@ of `current-buffer'."
1970 (+ digit) ":" (+ digit) ":" (+ digit) "." (+ digit) blank 1971 (+ digit) ":" (+ digit) ":" (+ digit) "." (+ digit) blank
1971 ;; Thread. 1972 ;; Thread.
1972 (? (group "#<thread " (+ nonl) ">") blank) 1973 (? (group "#<thread " (+ nonl) ">") blank)
1973 ;; Function name, verbosity. 1974 ;; Function name, verbosity.
1974 (+ (any "-" alnum)) " (" (group (+ digit)) ") #") 1975 (+ (any "-" alnum)) " (" (group (+ digit)) ") #")
1975 "Used for highlighting Tramp debug buffers in `outline-mode'.") 1976 "Used for highlighting Tramp debug buffers in `outline-mode'.")
1976 1977
@@ -2109,18 +2110,23 @@ ARGUMENTS to actually emit the message (if applicable)."
2109 (insert "\n")) 2110 (insert "\n"))
2110 ;; Timestamp. 2111 ;; Timestamp.
2111 (insert (format-time-string "%T.%6N ")) 2112 (insert (format-time-string "%T.%6N "))
2113 ;; Threads. `current-thread' might not exist when Emacs is
2114 ;; configured --without-threads.
2115 ;; (unless (eq (tramp-compat-funcall 'current-thread) main-thread)
2116 ;; (insert (format "%s " (tramp-compat-funcall 'current-thread))))
2112 ;; Calling Tramp function. We suppress compat and trace 2117 ;; Calling Tramp function. We suppress compat and trace
2113 ;; functions from being displayed. 2118 ;; functions from being displayed.
2114 (let ((btn 1) btf fn) 2119 (let ((frames (backtrace-frames))
2120 btf fn)
2115 (while (not fn) 2121 (while (not fn)
2116 (setq btf (nth 1 (backtrace-frame btn))) 2122 (setq btf (cadadr frames))
2117 (if (not btf) 2123 (if (not btf)
2118 (setq fn "") 2124 (setq fn "")
2119 (and (symbolp btf) (setq fn (symbol-name btf)) 2125 (and (symbolp btf) (setq fn (symbol-name btf))
2120 (or (not (string-prefix-p "tramp" fn)) 2126 (or (not (string-prefix-p "tramp" fn))
2121 (get btf 'tramp-suppress-trace)) 2127 (get btf 'tramp-suppress-trace))
2122 (setq fn nil)) 2128 (setq fn nil))
2123 (setq btn (1+ btn)))) 2129 (setq frames (cdr frames))))
2124 ;; The following code inserts filename and line number. 2130 ;; The following code inserts filename and line number.
2125 ;; Should be inactive by default, because it is time consuming. 2131 ;; Should be inactive by default, because it is time consuming.
2126 ;; (let ((ffn (find-function-noselect (intern fn)))) 2132 ;; (let ((ffn (find-function-noselect (intern fn))))
@@ -3790,14 +3796,14 @@ BODY is the backend specific code."
3790 ;; VISIT, for example `jka-compr-handler'. We must respect this. 3796 ;; VISIT, for example `jka-compr-handler'. We must respect this.
3791 ;; See Bug#55166. 3797 ;; See Bug#55166.
3792 `(let* ((filename (expand-file-name ,filename)) 3798 `(let* ((filename (expand-file-name ,filename))
3793 (lockname (file-truename (or ,lockname filename))) 3799 (lockname (file-truename (or ,lockname filename)))
3794 (handler (and (stringp ,visit) 3800 (handler (and (stringp ,visit)
3795 (let ((inhibit-file-name-handlers 3801 (let ((inhibit-file-name-handlers
3796 `(tramp-file-name-handler 3802 `(tramp-file-name-handler
3797 tramp-crypt-file-name-handler 3803 tramp-crypt-file-name-handler
3798 . inhibit-file-name-handlers)) 3804 . inhibit-file-name-handlers))
3799 (inhibit-file-name-operation 'write-region)) 3805 (inhibit-file-name-operation 'write-region))
3800 (find-file-name-handler ,visit 'write-region))))) 3806 (find-file-name-handler ,visit 'write-region)))))
3801 (with-parsed-tramp-file-name filename nil 3807 (with-parsed-tramp-file-name filename nil
3802 (if handler 3808 (if handler
3803 (progn 3809 (progn
@@ -5821,11 +5827,14 @@ Mostly useful to protect BODY from being interrupted by timers."
5821 (throw 'non-essential 'non-essential) 5827 (throw 'non-essential 'non-essential)
5822 (tramp-error 5828 (tramp-error
5823 ,proc 'remote-file-error "Forbidden reentrant call of Tramp")) 5829 ,proc 'remote-file-error "Forbidden reentrant call of Tramp"))
5824 (unwind-protect 5830 (let ((stimers (with-timeout-suspend))
5825 (progn 5831 timer-list timer-idle-list)
5826 (tramp-set-connection-property ,proc "locked" t) 5832 (unwind-protect
5827 ,@body) 5833 (progn
5828 (tramp-flush-connection-property ,proc "locked")))) 5834 (tramp-set-connection-property ,proc "locked" t)
5835 ,@body)
5836 (tramp-flush-connection-property ,proc "locked")
5837 (with-timeout-unsuspend stimers)))))
5829 5838
5830(defun tramp-accept-process-output (proc &optional _timeout) 5839(defun tramp-accept-process-output (proc &optional _timeout)
5831 "Like `accept-process-output' for Tramp processes. 5840 "Like `accept-process-output' for Tramp processes.
diff --git a/lisp/vc/vc-hg.el b/lisp/vc/vc-hg.el
index 5bab9aa529e..78480fd8062 100644
--- a/lisp/vc/vc-hg.el
+++ b/lisp/vc/vc-hg.el
@@ -578,7 +578,7 @@ This requires hg 4.4 or later, for the \"-L\" option of \"hg log\"."
578(defun vc-hg-annotate-command (file buffer &optional revision) 578(defun vc-hg-annotate-command (file buffer &optional revision)
579 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. 579 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
580Optional arg REVISION is a revision to annotate from." 580Optional arg REVISION is a revision to annotate from."
581 (apply #'vc-hg-command buffer 0 file "annotate" "-dq" "-n" 581 (apply #'vc-hg-command buffer 'async file "annotate" "-dq" "-n"
582 (append (vc-switches 'hg 'annotate) 582 (append (vc-switches 'hg 'annotate)
583 (if revision (list (concat "-r" revision)))))) 583 (if revision (list (concat "-r" revision))))))
584 584
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 8e4e7122a27..840decbf5d5 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2440,15 +2440,19 @@ This checks also `file-name-as-directory', `file-name-directory',
2440 `(,(expand-file-name tmp-name) 0))) 2440 `(,(expand-file-name tmp-name) 0)))
2441 (should (string-equal (buffer-string) "foo")) 2441 (should (string-equal (buffer-string) "foo"))
2442 (should (= point (point)))) 2442 (should (= point (point))))
2443 (let ((point (point))) 2443 ;; Insert another string.
2444 (replace-string-in-region "foo" "bar" (point-min) (point-max)) 2444 ;; `replace-string-in-region' was introduced in Emacs 28.1.
2445 (goto-char point) 2445 (when (tramp--test-emacs28-p)
2446 (should 2446 (let ((point (point)))
2447 (equal 2447 (with-no-warnings
2448 (insert-file-contents tmp-name nil nil nil 'replace) 2448 (replace-string-in-region "foo" "bar" (point-min) (point-max)))
2449 `(,(expand-file-name tmp-name) 3))) 2449 (goto-char point)
2450 (should (string-equal (buffer-string) "foo")) 2450 (should
2451 (should (= point (point)))) 2451 (equal
2452 (insert-file-contents tmp-name nil nil nil 'replace)
2453 `(,(expand-file-name tmp-name) 3)))
2454 (should (string-equal (buffer-string) "foo"))
2455 (should (= point (point)))))
2452 ;; Error case. 2456 ;; Error case.
2453 (delete-file tmp-name) 2457 (delete-file tmp-name)
2454 (should-error 2458 (should-error
@@ -7444,12 +7448,7 @@ This is needed in timer functions as well as process filters and sentinels."
7444 "Check parallel asynchronous requests. 7448 "Check parallel asynchronous requests.
7445Such requests could arrive from timers, process filters and 7449Such requests could arrive from timers, process filters and
7446process sentinels. They shall not disturb each other." 7450process sentinels. They shall not disturb each other."
7447 ;; :tags (append '(:expensive-test :tramp-asynchronous-processes) 7451 :tags '(:expensive-test :tramp-asynchronous-processes)
7448 ;; (and (or (getenv "EMACS_HYDRA_CI")
7449 ;; (getenv "EMACS_EMBA_CI"))
7450 ;; '(:unstable)))
7451 ;; It doesn't work sufficiently.
7452 :tags '(:expensive-test :tramp-asynchronous-processes :unstable)
7453 (skip-unless (tramp--test-enabled)) 7452 (skip-unless (tramp--test-enabled))
7454 (skip-unless (tramp--test-supports-processes-p)) 7453 (skip-unless (tramp--test-supports-processes-p))
7455 (skip-unless (not (tramp--test-container-p))) 7454 (skip-unless (not (tramp--test-container-p)))
@@ -7517,14 +7516,12 @@ process sentinels. They shall not disturb each other."
7517 (when buffers 7516 (when buffers
7518 (let ((time (float-time)) 7517 (let ((time (float-time))
7519 (default-directory tmp-name) 7518 (default-directory tmp-name)
7520 (file (buffer-name (seq-random-elt buffers))) 7519 (file (buffer-name (seq-random-elt buffers))))
7521 ;; A remote operation in a timer could
7522 ;; confuse Tramp heavily. So we ignore this
7523 ;; error here.
7524 (debug-ignored-errors
7525 (cons 'remote-file-error debug-ignored-errors)))
7526 (tramp--test-message 7520 (tramp--test-message
7527 "Start timer %s %s" file (current-time-string)) 7521 "Start timer %s %s" file (current-time-string))
7522 (dired-uncache file)
7523 (tramp--test-message
7524 "Continue timer %s %s" file (file-attributes file))
7528 (vc-registered file) 7525 (vc-registered file)
7529 (tramp--test-message 7526 (tramp--test-message
7530 "Stop timer %s %s" file (current-time-string)) 7527 "Stop timer %s %s" file (current-time-string))