emacs-diffs
[Top][All Lists]
Advanced

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

master dfda7d1463: Sanitize ls switches in ange-ftp (bug#53360)


From: Michael Albinus
Subject: master dfda7d1463: Sanitize ls switches in ange-ftp (bug#53360)
Date: Mon, 7 Feb 2022 04:07:25 -0500 (EST)

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

    Sanitize ls switches in ange-ftp (bug#53360)
    
    * lisp/net/ange-ftp.el (ls-lisp--sanitize-switches): Declare.
    (ange-ftp-ls): Sanitize LSARGS.  (Bug#53360)
---
 lisp/net/ange-ftp.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index a6904fc07e..ef8527fada 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2547,13 +2547,16 @@ can parse the output from a DIR listing for a host of 
type TYPE.")
 (defvar ange-ftp-after-parse-ls-hook nil
   "Normal hook run after parsing the text of an FTP directory listing.")
 
+(declare-function ls-lisp--sanitize-switches "ls-lisp" (switches))
+
 (defun ange-ftp-ls (file lsargs parse &optional no-error wildcard)
   "Return the output of a `DIR' or `ls' command done over FTP.
 FILE is the full name of the remote file, LSARGS is any args to pass to the
 `ls' command, and PARSE specifies that the output should be parsed and stored
 away in the internal cache."
-  (while (string-match "^--dired\\s-+" lsargs)
-    (setq lsargs (replace-match "" nil t lsargs)))
+  (when (string-match "--" lsargs)
+    (require 'ls-lisp)
+    (setq lsargs (ls-lisp--sanitize-switches lsargs)))
   ;; If parse is t, we assume that file is a directory. i.e. we only parse
   ;; full directory listings.
   (let* ((ange-ftp-this-file (ange-ftp-expand-file-name file))



reply via email to

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