emacs-diffs
[Top][All Lists]
Advanced

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

feature/android 5e416d02c59 1/2: Merge remote-tracking branch 'origin/ma


From: Po Lu
Subject: feature/android 5e416d02c59 1/2: Merge remote-tracking branch 'origin/master' into feature/android
Date: Wed, 1 Mar 2023 20:27:56 -0500 (EST)

branch: feature/android
commit 5e416d02c59e356e6f7677a9132896d824bcb337
Merge: daf9c62871a 4b99015e15a
Author: Po Lu <luangruo@yahoo.com>
Commit: Po Lu <luangruo@yahoo.com>

    Merge remote-tracking branch 'origin/master' into feature/android
---
 lisp/emacs-lisp/byte-opt.el  |  4 +--
 lisp/net/tramp-sh.el         | 80 ++++++++++++++++----------------------------
 test/lisp/net/tramp-tests.el |  8 +++--
 3 files changed, 35 insertions(+), 57 deletions(-)

diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 12aa8fb3982..0ae4c452c73 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -515,9 +515,7 @@ for speeding up processing.")
                           form)
                          nil)))))
        (byte-compile-log "  %s called for effect; deleted" fn)
-       ;; appending a nil here might not be necessary, but it can't hurt.
-       (byte-optimize-form
-       (cons 'progn (append (cdr form) '(nil))) t))
+       (byte-optimize-form (cons 'progn (cdr form)) t))
 
       (_
        ;; Otherwise, no args can be considered to be for-effect,
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index b3d837f9514..ce443b558a3 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -631,7 +631,6 @@ foreach $f (@files) {
   print \"$f\\n\";
  }
 }
-print \"ok\\n\"
 ' \"$1\" %n"
   "Perl script to produce output suitable for use with
 `file-name-all-completions' on the remote file system.
@@ -1768,57 +1767,34 @@ ID-FORMAT valid values are `string' and `integer'."
           ;; Get a list of directories and files, including reliably
           ;; tagging the directories with a trailing "/".  Because I
           ;; rock.  --daniel@danann.net
-          (tramp-send-command
-           v
-           (if (tramp-get-remote-perl v)
-               (progn
-                 (tramp-maybe-send-script
-                  v tramp-perl-file-name-all-completions
-                  "tramp_perl_file_name_all_completions")
-                 (format "tramp_perl_file_name_all_completions %s"
-                         (tramp-shell-quote-argument localname)))
-
-             (format (concat
-                      "(cd %s 2>&1 && %s -a 2>%s"
-                      " | while IFS= read f; do"
-                      " if %s -d \"$f\" 2>%s;"
-                      " then \\echo \"$f/\"; else \\echo \"$f\"; fi; done"
-                      " && \\echo ok) || \\echo fail")
-                     (tramp-shell-quote-argument localname)
-                     (tramp-get-ls-command v)
-                      (tramp-get-remote-null-device v)
-                     (tramp-get-test-command v)
-                      (tramp-get-remote-null-device v))))
-
-          ;; Now grab the output.
-          (with-current-buffer (tramp-get-buffer v)
-            (goto-char (point-max))
-
-            ;; Check result code, found in last line of output.
-            (forward-line -1)
-            (if (looking-at-p (rx bol "fail" eol))
-                (progn
-                  ;; Grab error message from line before last line
-                  ;; (it was put there by `cd 2>&1').
-                  (forward-line -1)
-                  (tramp-error
-                   v 'file-error
-                   "tramp-sh-handle-file-name-all-completions: %s"
-                   (buffer-substring (point) (line-end-position))))
-              ;; For peace of mind, if buffer doesn't end in `fail'
-              ;; then it should end in `ok'.  If neither are in the
-              ;; buffer something went seriously wrong on the remote
-              ;; side.
-              (unless (looking-at-p (rx bol "ok" eol))
-                (tramp-error
-                 v 'file-error
-                 (concat "tramp-sh-handle-file-name-all-completions: "
-                         "internal error accessing `%s': `%s'")
-                 (tramp-shell-quote-argument localname) (buffer-string))))
-
-            (while (zerop (forward-line -1))
-              (push (buffer-substring (point) (line-end-position)) result)))
-          result))))))
+          (when (tramp-send-command-and-check
+                 v
+                 (if (tramp-get-remote-perl v)
+                     (progn
+                       (tramp-maybe-send-script
+                        v tramp-perl-file-name-all-completions
+                        "tramp_perl_file_name_all_completions")
+                       (format "tramp_perl_file_name_all_completions %s"
+                               (tramp-shell-quote-argument localname)))
+
+                   (format (concat
+                            "cd %s 2>&1 && %s -a 2>%s"
+                            " | while IFS= read f; do"
+                            " if %s -d \"$f\" 2>%s;"
+                            " then \\echo \"$f/\"; else \\echo \"$f\"; fi;"
+                            " done")
+                           (tramp-shell-quote-argument localname)
+                           (tramp-get-ls-command v)
+                           (tramp-get-remote-null-device v)
+                           (tramp-get-test-command v)
+                           (tramp-get-remote-null-device v))))
+
+            ;; Now grab the output.
+            (with-current-buffer (tramp-get-buffer v)
+              (goto-char (point-max))
+              (while (zerop (forward-line -1))
+                (push (buffer-substring (point) (line-end-position)) result)))
+            result)))))))
 
 ;; cp, mv and ln
 
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 69004bdbdf3..948bf0ab9e2 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -2530,7 +2530,7 @@ This checks also `file-name-as-directory', 
`file-name-directory',
                        (rx bos))
                      tramp--test-messages))))))
 
-           ;; We do not test lockname here.  See
+           ;; We do not test the lock file here.  See
            ;; `tramp-test39-make-lock-file-name'.
 
            ;; Do not overwrite if excluded.
@@ -4635,6 +4635,10 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
          ;; Cleanup.
          (ignore-errors (delete-directory tmp-name 'recursive)))))))
 
+(tramp--test-deftest-with-perl tramp-test26-file-name-completion)
+
+(tramp--test-deftest-with-ls tramp-test26-file-name-completion)
+
 ;; This test is inspired by Bug#51386, Bug#52758, Bug#53513, Bug#54042
 ;; and Bug#60505.
 (ert-deftest tramp-test26-interactive-file-name-completion ()
@@ -6561,7 +6565,7 @@ INPUT, if non-nil, is a string sent to the process."
                          (lambda (&rest _args) "yes")))
                 (kill-buffer)))
            ;; A new connection changes process id, and also the
-           ;; lockname contents.  But the lock file still exists.
+           ;; lock file contents.  But it still exists.
            (tramp-cleanup-connection tramp-test-vec 'keep-debug 'keep-password)
            (should (stringp (with-no-warnings (file-locked-p tmp-name1))))
 



reply via email to

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