emacs-diffs
[Top][All Lists]
Advanced

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

master 46978fa1eff 1/2: Merge from origin/emacs-29


From: Eli Zaretskii
Subject: master 46978fa1eff 1/2: Merge from origin/emacs-29
Date: Sat, 30 Sep 2023 13:55:17 -0400 (EDT)

branch: master
commit 46978fa1eff286ea15248ee358fe62608ca070c5
Merge: e6dd64aaba5 4776d90c31b
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Merge from origin/emacs-29
    
    4776d90c31b Add new Tramp test
    ca5b48fd76d Fix tmm-mid-prompt :type (Bug#66179)
    7447d3df94e Fix tree-sitter indentation conflict with multiple languages
    bee18e52737 Fix bug#66093 in Tramp
    7d5fee0feaa Support regeneration of ja-dic.el under '--with-small-ja-...
    
    Conflicts:
            make-dist
---
 .gitignore                                       |  1 +
 java/org/gnu/emacs/EmacsDesktopNotification.java |  2 +-
 leim/Makefile.in                                 |  9 +++-
 lisp/international/ja-dic-cnv.el                 |  2 +
 lisp/net/tramp-sshfs.el                          |  4 +-
 lisp/net/tramp.el                                | 11 +++--
 lisp/tmm.el                                      |  3 +-
 lisp/treesit.el                                  |  4 +-
 make-dist                                        |  5 +-
 test/lisp/net/tramp-tests.el                     | 61 +++++++++++++++++++++++-
 10 files changed, 88 insertions(+), 14 deletions(-)

diff --git a/.gitignore b/.gitignore
index 0a68121009d..81abc4c90ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -127,6 +127,7 @@ lisp/cedet/semantic/grammar-wy.el
 lisp/eshell/esh-groups.el
 lisp/finder-inf.el
 lisp/leim/ja-dic/
+leim/small-ja-dic-option
 lisp/leim/leim-list.el
 lisp/leim/quail/4Corner.el
 lisp/leim/quail/ARRAY30.el
diff --git a/java/org/gnu/emacs/EmacsDesktopNotification.java 
b/java/org/gnu/emacs/EmacsDesktopNotification.java
index 56ed984d497..4a6bbf7a606 100644
--- a/java/org/gnu/emacs/EmacsDesktopNotification.java
+++ b/java/org/gnu/emacs/EmacsDesktopNotification.java
@@ -137,7 +137,7 @@ public final class EmacsDesktopNotification
            priority = Notification.PRIORITY_HIGH;
            break;
          }
-       
+
        notification = (new Notification.Builder (context)
                        .setContentTitle (title)
                        .setContentText (content)
diff --git a/leim/Makefile.in b/leim/Makefile.in
index 4c6c3179283..f7dfdf66f30 100644
--- a/leim/Makefile.in
+++ b/leim/Makefile.in
@@ -26,6 +26,7 @@ SHELL = @SHELL@
 # Here are the things that we expect ../configure to edit.
 srcdir=@srcdir@
 top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
 
 # Where the generated files go.
 leimdir = ${srcdir}/../lisp/leim
@@ -134,9 +135,15 @@ ${leimdir}/leim-list.el: ${srcdir}/leim-ext.el ${TIT_MISC}
 
 ${leimdir}/ja-dic/ja-dic.el: | $(leimdir)/ja-dic
 
+# This is used to support regeneration of ja-dic when the SMALL_JA_DIC
+# option is flipped by the configure-time option.
+small-ja-dic-option: ../config.status
+       $(AM_V_GEN)echo "Small ja-dic option: $(SMALL_JA_DIC)" > $@.$$$$ && \
+         ${top_srcdir}/build-aux/move-if-change $@.$$$$ $@
+
 .PHONY: generate-ja-dic
 generate-ja-dic: ${leimdir}/ja-dic/ja-dic.el
-${leimdir}/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L
+${leimdir}/ja-dic/ja-dic.el: $(srcdir)/SKK-DIC/SKK-JISYO.L small-ja-dic-option
        $(AM_V_GEN)$(RUN_EMACS) -batch -l ja-dic-cnv \
          -f batch-skkdic-convert -dir "$(leimdir)/ja-dic" 
$(JA_DIC_NO_REDUCTION_OPTION) "$<"
 
diff --git a/lisp/international/ja-dic-cnv.el b/lisp/international/ja-dic-cnv.el
index 5477473ae8c..81d5a1acdf4 100644
--- a/lisp/international/ja-dic-cnv.el
+++ b/lisp/international/ja-dic-cnv.el
@@ -346,6 +346,8 @@ If NO-REDUCTION is non-nil, do not reduce the dictionary 
vocabulary."
       (erase-buffer)
       (buffer-disable-undo)
       (generate-lisp-file-heading ja-dic-filename 'skkdic-convert :code nil)
+      (insert (format ";; Generated with small ja-dic option: %s\n\n"
+                      (if no-reduction "no" "yes")))
       (insert ";; Original SKK dictionary file: "
              (file-relative-name (expand-file-name filename) dirname)
              "\n\n"
diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el
index 131f632a0fe..102ba637f55 100644
--- a/lisp/net/tramp-sshfs.el
+++ b/lisp/net/tramp-sshfs.el
@@ -60,7 +60,7 @@
                ;; These are for remote processes.
                 (tramp-login-program        "ssh")
                 (tramp-login-args           (("-q") ("-l" "%u") ("-p" "%p")
-                                            ("-e" "none") ("-t" "-t")
+                                            ("-e" "none") ("%a" "%a")
                                             ("%h") ("%l")))
                 (tramp-direct-async         t)
                 (tramp-remote-shell         ,tramp-default-remote-shell)
@@ -326,7 +326,7 @@ arguments to pass to the OPERATION."
            ?h (or (tramp-file-name-host v) "")
            ?u (or (tramp-file-name-user v) "")
            ?p (or (tramp-file-name-port v) "")
-           ?l command))
+            ?a "-t" ?l command))
 
        ;; Synchronize stderr.
        (when tmpstderr
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 782582e1daf..8f5ca9b3c2d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -240,9 +240,9 @@ pair of the form (KEY VALUE).  The following KEYs are 
defined:
     \"%\" followed by a letter are expanded in the arguments as
     follows:
 
-    - \"%h\" is replaced by the host name
-    - \"%u\" is replaced by the user name
-    - \"%p\" is replaced by the port number
+    - \"%h\" is replaced by the host name.
+    - \"%u\" is replaced by the user name.
+    - \"%p\" is replaced by the port number.
     - \"%%\" can be used to obtain a literal percent character.
 
     If a sub-list containing \"%h\", \"%u\" or \"%p\" is
@@ -271,6 +271,8 @@ pair of the form (KEY VALUE).  The following KEYs are 
defined:
     - \"%z\" is replaced by the `tramp-scp-direct-remote-copying'
       argument if it is supported.
     - \"%d\" is replaced by the device detected by `tramp-adb-get-device'.
+    - \"%a\" adds the pseudo-terminal allocation argument \"-t\" in
+       asynchronous processes, if the connection type is not `pipe'.
 
     The existence of `tramp-login-args', combined with the
     absence of `tramp-copy-args', is an indication that the
@@ -4870,6 +4872,7 @@ a connection-local variable."
                  (when adb-file-name-handler-p
                    (tramp-compat-funcall
                     'tramp-adb-get-device v)))
+                 (pta (unless (eq connection-type 'pipe) "-t"))
                 login-args p)
 
            ;; Replace `login-args' place holders.  Split
@@ -4885,7 +4888,7 @@ a connection-local variable."
                 v 'tramp-login-args
                 ?h (or host "") ?u (or user "") ?p (or port "")
                 ?c (format-spec (or options "") (format-spec-make ?t tmpfile))
-                ?d (or device "") ?l ""))))
+                ?d (or device "") ?a (or pta "") ?l ""))))
             p (make-process
                :name name :buffer buffer
                :command (append `(,login-program) login-args command)
diff --git a/lisp/tmm.el b/lisp/tmm.el
index a4058594622..b587b416a35 100644
--- a/lisp/tmm.el
+++ b/lisp/tmm.el
@@ -79,7 +79,8 @@ See the documentation for `tmm-prompt'."
   "String to insert between shortcut and menu item.
 If nil, there will be no shortcuts.  It should not consist only of spaces,
 or else the correct item might not be found in the `*Completions*' buffer."
-  :type 'string)
+  :type '(choice (const :tag "No shortcuts" nil)
+                 string))
 
 (defvar tmm-mb-map nil
   "A place to store minibuffer map.")
diff --git a/lisp/treesit.el b/lisp/treesit.el
index fd8c8482fc8..402417c6ca9 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1692,8 +1692,8 @@ Return (ANCHOR . OFFSET).  This function is used by
                                 bol (car local-parsers)))
                 ((eq 1 (length (treesit-parser-list nil nil t)))
                  (treesit-node-at bol))
-                ((treesit-language-at (point))
-                 (treesit-node-at bol (treesit-language-at (point))))
+                ((treesit-language-at bol)
+                 (treesit-node-at bol (treesit-language-at bol)))
                 (t (treesit-node-at bol))))
          (root (treesit-parser-root-node
                 (treesit-node-parser smallest-node)))
diff --git a/make-dist b/make-dist
index a3b7219af3a..2c4b6a79500 100755
--- a/make-dist
+++ b/make-dist
@@ -356,8 +356,9 @@ possibly_non_vc_files="
   $top_level_ChangeLog
   MANIFEST aclocal.m4 configure
   admin/charsets/jisx2131-filter
-  src/config.in exec/configure
-  exec/config.h.in
+  src/config.in
+  exec/configure exec/config.h.in
+  leim/small-ja-dic-option
 "$(
   find admin doc etc lisp \
    \( -name '*.el' -o -name '*.elc' -o -name '*.map' -o -name '*.stamp' \
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 69d31a54644..e382d044275 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -7886,7 +7886,7 @@ process sentinels.  They shall not disturb each other."
       (shell-command-to-string "read -s -p Password: pass"))))
 
   (let ((pass "secret")
-       (mock-entry (copy-sequence (assoc "mock" tramp-methods)))
+       (mock-entry (copy-tree (assoc "mock" tramp-methods)))
        mocked-input tramp-methods)
     ;; We must mock `read-string', in order to avoid interactive
     ;; arguments.
@@ -7933,6 +7933,65 @@ process sentinels.  They shall not disturb each other."
          (let ((auth-sources `(,netrc-file)))
            (should (file-exists-p ert-remote-temporary-file-directory)))))))))
 
+(ert-deftest tramp-test46-read-otp-password ()
+  "Check Tramp one-time password handling."
+  :tags '(:expensive-test)
+  (skip-unless (tramp--test-mock-p))
+  ;; Not all read commands understand argument "-s" or "-p".
+  (skip-unless
+   (string-empty-p
+    (let ((shell-file-name "sh"))
+      (shell-command-to-string "read -s -p Password: pass"))))
+
+  (let ((pass "secret")
+       (mock-entry (copy-tree (assoc "mock" tramp-methods)))
+       mocked-input tramp-methods)
+    ;; We must mock `read-string', in order to avoid interactive
+    ;; arguments.
+    (cl-letf* (((symbol-function #'read-string)
+               (lambda (&rest _args) (pop mocked-input))))
+      (setcdr
+       (assq 'tramp-login-args mock-entry)
+       `((("-c")
+         (,(tramp-shell-quote-argument
+            (concat
+             "read -s -p 'Verification code: ' pass; echo; "
+             "(test \"pass$pass\" != \"pass" pass "\" && "
+             "echo \"Login incorrect\" || sh -i)"))))))
+      (setq tramp-methods `(,mock-entry))
+
+      ;; Reading password from stdin works.
+      (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+      ;; We don't want to invalidate the password.
+      (setq mocked-input `(,(copy-sequence pass)))
+      (should (file-exists-p ert-remote-temporary-file-directory))
+
+      ;; Don't entering a password returns in error.
+      (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+      (setq mocked-input nil)
+      (should-error (file-exists-p ert-remote-temporary-file-directory))
+
+      ;; A wrong password doesn't work either.
+      (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+      (setq mocked-input `(,(concat pass pass)))
+      (should-error (file-exists-p ert-remote-temporary-file-directory))
+
+      ;; The password shouldn't be read from auth-source.
+      ;; Macro `ert-with-temp-file' was introduced in Emacs 29.1.
+      (with-no-warnings (when (symbol-plist 'ert-with-temp-file)
+       (tramp-cleanup-connection tramp-test-vec 'keep-debug)
+       (setq mocked-input nil)
+       (auth-source-forget-all-cached)
+       (ert-with-temp-file netrc-file
+         :prefix "tramp-test" :suffix ""
+         :text (format
+                "machine %s port mock password %s"
+                (file-remote-p ert-remote-temporary-file-directory 'host)
+                pass)
+         (let ((auth-sources `(,netrc-file)))
+           (should-error
+            (file-exists-p ert-remote-temporary-file-directory)))))))))
+
 ;; This test is inspired by Bug#29163.
 (ert-deftest tramp-test48-auto-load ()
   "Check that Tramp autoloads properly."



reply via email to

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