emacs-diffs
[Top][All Lists]
Advanced

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

master f3b9d5b: Some Tramp fixes, resulting from test campaign


From: Michael Albinus
Subject: master f3b9d5b: Some Tramp fixes, resulting from test campaign
Date: Tue, 19 Jan 2021 12:46:02 -0500 (EST)

branch: master
commit f3b9d5b3155fac293d46e55827a1e0ce07afb0ae
Author: Michael Albinus <michael.albinus@gmx.de>
Commit: Michael Albinus <michael.albinus@gmx.de>

    Some Tramp fixes, resulting from test campaign
    
    * doc/misc/tramp.texi (Remote shell setup): Clarifications for
    `tramp-actions-before-shell' example.
    
    * lisp/net/tramp-sh.el (tramp-sh-handle-insert-directory): Do not expand
    FILENAME explicitely.
    (tramp-open-shell): Add "-i" for interactive shells.
    
    * test/lisp/net/tramp-tests.el (tramp-test07-file-exists-p)
    (tramp-test14-delete-directory)
    (tramp-test43-asynchronous-requests): Skip for MS windows.
---
 doc/misc/tramp.texi          |  8 ++++++--
 lisp/net/tramp-sh.el         |  8 +++++---
 test/lisp/net/tramp-tests.el | 22 +++++++++++-----------
 3 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index 2c4b792..e9ffd6a 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2369,8 +2369,7 @@ that can identify such questions using
 @lisp
 @group
 (defconst my-tramp-prompt-regexp
-  (concat (regexp-opt '("Enter the birth date of your mother:") t)
-          "\\s-*")
+  "Enter the birth date of your mother:\\s-*"
   "Regular expression matching my login prompt question.")
 @end group
 
@@ -2389,6 +2388,11 @@ that can identify such questions using
 @end group
 @end lisp
 
+The regular expressions used in @code{tramp-actions-before-shell} must
+match the end of the connection buffer.  Due to performance reasons,
+this search starts at the end of the buffer, and it is limited to 256
+characters backwards.
+
 
 @item Conflicting names for users and variables in @file{.profile}
 
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index e8ee372..618a9fb 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2608,12 +2608,11 @@ The method used must be an out-of-band method."
 (defun tramp-sh-handle-insert-directory
     (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for Tramp files."
-  (setq filename (expand-file-name filename))
   (unless switches (setq switches ""))
   ;; Check, whether directory is accessible.
   (unless wildcard
     (access-file filename "Reading directory"))
-  (with-parsed-tramp-file-name filename nil
+  (with-parsed-tramp-file-name (expand-file-name filename) nil
     (if (and (featurep 'ls-lisp)
             (not (symbol-value 'ls-lisp-use-insert-directory-program)))
        (tramp-handle-insert-directory
@@ -4306,11 +4305,14 @@ file exists and nonzero exit status otherwise."
     ;; ensure they have the correct values when the shell starts, not
     ;; just processes run within the shell.  (Which processes include
     ;; our initial probes to ensure the remote shell is usable.)
+    ;; For the time being, we assume that all shells interpret -i as
+    ;; interactive shell.  Must be the last argument, because (for
+    ;; example) bash expects long options first.
     (tramp-send-command
      vec (format
          (concat
           "exec env TERM='%s' INSIDE_EMACS='%s,tramp:%s' "
-          "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s")
+          "ENV=%s %s PROMPT_COMMAND='' PS1=%s PS2='' PS3='' %s %s -i")
           tramp-terminal-type
           (or (getenv "INSIDE_EMACS") emacs-version) tramp-version
           (or (getenv-internal "ENV" tramp-remote-process-environment) "")
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index ef0968a..5deee65 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2272,8 +2272,8 @@ This checks also `file-name-as-directory', 
`file-name-directory',
       (delete-file tmp-name)
       (should-not (file-exists-p tmp-name))
 
-      ;; Trashing files doesn't work for crypted remote files.
-      (unless (tramp--test-crypt-p)
+      ;; Trashing files doesn't work on MS Windows, and for crypted remote 
files.
+      (unless (or (tramp--test-windows-nt-p) (tramp--test-crypt-p))
        (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
              (delete-by-moving-to-trash t))
          (make-directory trash-directory)
@@ -2786,9 +2786,9 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
       (should-not (file-directory-p tmp-name1))
 
       ;; Trashing directories works only since Emacs 27.1.  It doesn't
-      ;; work for crypted remote directories and for ange-ftp.
-      (when (and (not (tramp--test-crypt-p)) (not (tramp--test-ftp-p))
-                (tramp--test-emacs27-p))
+      ;; work on MS Windows, for crypted remote directories and for ange-ftp.
+      (when (and (not  (tramp--test-windows-nt-p)) (not (tramp--test-crypt-p))
+                (not (tramp--test-ftp-p)) (tramp--test-emacs27-p))
        (let ((trash-directory (tramp--test-make-temp-name 'local quoted))
              (delete-by-moving-to-trash t))
          (make-directory trash-directory)
@@ -6349,6 +6349,7 @@ process sentinels.  They shall not disturb each other."
                   (tramp--test-sh-p)))
   (skip-unless (not (tramp--test-crypt-p)))
   (skip-unless (not (tramp--test-docker-p)))
+  (skip-unless (not (tramp--test-windows-nt-p)))
 
   (with-timeout
       (tramp--test-asynchronous-requests-timeout (tramp--test-timeout-handler))
@@ -6358,12 +6359,11 @@ process sentinels.  They shall not disturb each other."
           (shell-file-name (if (tramp--test-adb-p) "/system/bin/sh" "/bin/sh"))
           ;; It doesn't work on w32 systems.
           (watchdog
-           (unless (tramp--test-windows-nt-p)
-              (start-process-shell-command
-               "*watchdog*" nil
-               (format
-               "sleep %d; kill -USR1 %d"
-               tramp--test-asynchronous-requests-timeout (emacs-pid)))))
+            (start-process-shell-command
+             "*watchdog*" nil
+             (format
+             "sleep %d; kill -USR1 %d"
+             tramp--test-asynchronous-requests-timeout (emacs-pid))))
            (tmp-name (tramp--test-make-temp-name))
            (default-directory tmp-name)
            ;; Do not cache Tramp properties.



reply via email to

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