From 7d5fee0feaa5740f3fbbfc6d5f13855bf58b9c25 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 24 Sep 2023 15:30:01 +0300 Subject: [PATCH 1/5] Support regeneration of ja-dic.el under '--with-small-ja-dic' * lisp/international/ja-dic-cnv.el (skkdic-convert): Record the value of SMALL_JA_DIC option used to produce ja-dic.el. * leim/Makefile.in (small-ja-dic-option): New target, triggers regeneration of ja-dic.el when the value of SMALL_JA_DIC option changes by the configure script. Suggested by Ulrich Mueller . (${leimdir}/ja-dic/ja-dic.el): Depend on 'small-ja-dic-option'. (Bug#66125) * make-dist (possibly_non_vc_files): * .gitignore: Add 'leim/small-ja-dic-option'. --- .gitignore | 1 + leim/Makefile.in | 9 ++++++++- lisp/international/ja-dic-cnv.el | 2 ++ make-dist | 1 + 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index b09a0c030b3..3cec4cc0685 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,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/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 9ce31f11d91..c507aa58807 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/make-dist b/make-dist index 80c672dbf3a..57881d50f0d 100755 --- a/make-dist +++ b/make-dist @@ -357,6 +357,7 @@ possibly_non_vc_files=" MANIFEST aclocal.m4 configure admin/charsets/jisx2131-filter src/config.in + leim/small-ja-dic-option "$( find admin doc etc lisp \ \( -name '*.el' -o -name '*.elc' -o -name '*.map' -o -name '*.stamp' \ From bee18e527379d2474e7a4ca62c53b6f21d8f9315 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Sun, 24 Sep 2023 17:15:05 +0200 Subject: [PATCH 2/5] Fix bug#66093 in Tramp * lisp/net/tramp-sshfs.el (tramp-methods): Use "%a". (tramp-sshfs-handle-process-file): Replace ?a by "-t". * lisp/net/tramp.el (tramp-methods): Adapt docstring. (Bug#66093) (tramp-handle-make-process): Replace ?a by "-t" if indicated. --- lisp/net/tramp-sshfs.el | 4 ++-- lisp/net/tramp.el | 11 +++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/lisp/net/tramp-sshfs.el b/lisp/net/tramp-sshfs.el index c638d32ec35..ace9b3bda4a 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) @@ -323,7 +323,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 8ace0165ed9..6b64e26b107 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -252,9 +252,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 @@ -283,6 +283,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 @@ -5033,6 +5035,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for (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 @@ -5049,7 +5052,7 @@ substitution. SPEC-LIST is a list of char/value pairs used for 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) From 7447d3df94e49bef8577008d76a6b1f6a4013146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Augustin=20Ch=C3=A9neau?= Date: Wed, 20 Sep 2023 12:23:22 +0200 Subject: [PATCH 3/5] Fix tree-sitter indentation conflict with multiple languages * lisp/treesit.el (treesit--indent-1): Use bol instead of point. Copyright-paperwork-exempt: yes --- lisp/treesit.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/treesit.el b/lisp/treesit.el index 8163ffdf329..c24ea90bba0 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el @@ -1486,8 +1486,8 @@ Return (ANCHOR . OFFSET). This function is used by (cond ((null (treesit-parser-list)) nil) ((eq 1 (length (treesit-parser-list))) (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))) From ca5b48fd76db2ab7c154c2db6a7d4a9fb7857f6c Mon Sep 17 00:00:00 2001 From: Mauro Aranda Date: Sun, 24 Sep 2023 09:31:01 -0300 Subject: [PATCH 4/5] Fix tmm-mid-prompt :type (Bug#66179) * lisp/tmm.el (tmm-mid-prompt): Allow nil. --- lisp/tmm.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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.") From 4776d90c31b3d5bc4117ca7ecde95444adf402ac Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 25 Sep 2023 12:48:32 +0200 Subject: [PATCH 5/5] Add new Tramp test * test/lisp/net/tramp-tests.el (tramp-test46-read-password): Use `copy-tree' but `copy-sequence'. (tramp-test46-read-otp-password): New test. --- test/lisp/net/tramp-tests.el | 61 +++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 6021eda8dff..3c2ec9275c6 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -7843,7 +7843,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. @@ -7890,6 +7890,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-test47-auto-load () "Check that Tramp autoloads properly."