[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connecti
From: |
Rasmus |
Subject: |
bug#19192: 25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection |
Date: |
Sun, 30 Nov 2014 13:43:44 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
Hi,
Michael Albinus <michael.albinus@gmx.de> writes:
>> So according to the note in `ange-ftp-get-files' there's the following
>> node on using dired-actual-switches or dired-listing-switches
>>
>> ;; This is an efficiency hack. We try to
>> ;; anticipate what sort of listing dired
>> ;; might want, and cache just such a listing.
>>
>> Switches are checked with `ange-ftp-switches-ok'. (man "sftp") has a
>> nice list of
>> switches supported. Unfortunately, I don't really find anything on
>> supported ls in the manpage of ftp or the info manual...
>>
>> Option I: I can limit accepted ls flags by ange-ftp to the subset
>> supported by sftp.
>>
>> Option I+: I could add a defcustom to allow the current more liberal
>> behavior akin to ange-ftp-passive-host-alist and
>> ange-ftp-try-passive-mode.
>>
>> Option II would be to add build-in support for something like the
>> --group-directories-first in dired, since now, if scrub off
>> --group-directories-first, a dired-ftp buffer will look different from a
>> local dired buffer...
>>
>> For now I will go with Option I.
>
> Well, I'm a little bit confused. In the beginning, you have spoken about
> "ftp". Now you've switched to "sftp". These are very different cases,
> and ange-ftp.el is *not* responsible for sftp connections.
>
> Could you, please, clarify?
That comment is obsolete. See why here:
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=19192#20
I tried all long commands with my ftp server (Debian-hosted) and discard
the ones that breaks ls over ftp.
Feel free to try the attached patch.
Cheers,
Rasmus
--
If you can mix business and politics wonderful things can happen!
>From 6fd921e7d7deb88c5a3f172022b64a0539edbdd6 Mon Sep 17 00:00:00 2001
From: Rasmus <rasmus@gmx.us>
Date: Sat, 29 Nov 2014 13:12:10 +0100
Subject: [PATCH] ange-ftp.el: Disallow more dired ls-flags
* net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
trouble with ls over ftp. These flags result in ls returning no
output, causing Tramp-breakage.
Fixes: debbugs:19192
---
lisp/ChangeLog | 6 ++++++
lisp/net/ange-ftp.el | 12 +++++++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2a450a7..7d0992e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-11-29 Rasmus Pank Roulund <emacs@pank.eu>
+
+ * net/ange-ftp.el (ange-ftp-switches-ok): Disallow flags causing
+ trouble with ls over ftp. These flags result in ls returning no
+ output, causing Tramp-breakage. (bug#19192)
+
2014-11-29 Stephen Berman <stephen.berman@gmx.net>
Stefan Monnier <monnier@iro.umontreal.ca>
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index d7632ed..a2b0b46 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2831,16 +2831,26 @@ match subdirectories as well.")
files ange-ftp-files-hashtable)))
(defun ange-ftp-switches-ok (switches)
- "Return SWITCHES (a string) if suitable for our use."
+ "Return SWITCHES (a string) if suitable for use with ls over ftp."
(and (stringp switches)
;; We allow the A switch, which lists all files except "." and
;; "..". This is OK because we manually insert these entries
;; in the hash table.
(string-match
"--\\(almost-\\)?all\\>\\|\\(\\`\\| \\)-[[:alpha:]]*[aA]" switches)
+ ;; Allow flags starting with a single dash
(string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
+ ;; Disallow recursive flag
(not (string-match
"--recursive\\>\\|\\(\\`\\| \\)-[[:alpha:]]*R" switches))
+ ;; Disallow most long flags from (man "ls"), version 8.23 of July 2014.
+ (not (string-match
+ (concat
+ "--\\(block-size\\|color\\|format\\|group-directories-first\\|"
+
"human-readable\\|dereference-command-line\\|hide\\|indicator-style\\|"
+
"dereference-command-line-symlink-to-dir\\|inode\\|ignore\\|dereference\\|"
+
"numeric-uid-gid\\|indicator-style\\|hide-control-chars\\|quoting-style\\|"
+ "sort\\|time\\|time-style\\|width\\)")))
switches))
(defun ange-ftp-get-files (directory &optional no-error)
--
2.1.3