GNU bug report logs - #19192
25.0.50; TRAMP uses `dired-listing-switches' for ftp-connection

Previous Next

Package: emacs;

Reported by: Rasmus <rasmus <at> gmx.us>

Date: Wed, 26 Nov 2014 12:05:02 UTC

Severity: normal

Found in version 25.0.50

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


Message #20 received at 19192 <at> debbugs.gnu.org (full text, mbox):

From: Rasmus <rasmus <at> gmx.us>
To: michael.albinus <at> gmx.de
Cc: 19192 <at> debbugs.gnu.org
Subject: Re: bug#19192: 25.0.50;
 TRAMP uses `dired-listing-switches' for ftp-connection
Date: Sat, 29 Nov 2014 13:21:57 +0100
[Message part 1 (text/plain, inline)]
Rasmus <rasmus <at> gmx.us> writes:

> For now I will go with Option I.

Well, turned out to be a bad idea.  Instead I tested all flags in (man
"ls") and exclude the flags that caused trouble.  Note, I only have one
ftp to test against. . .  I'm assuming this one is somewhat common.

Also, a limitation of the `ange-ftp-switches-ok' is that it's too
destructive: I.e. rather than removing offending ls-flags, it will
entirely disregard the whole thing.  I guess that's another patch,
though.

If you find the patch OK, feel free to submit.  Otherwise, let me know
what to improve.

Thanks,
Rasmus

-- 
The right to be left alone is a human right
[0001-ange-ftp.el-Disallow-more-dired-ls-flags.patch (text/x-diff, inline)]
From 6fd921e7d7deb88c5a3f172022b64a0539edbdd6 Mon Sep 17 00:00:00 2001
From: Rasmus <w530 <at> pank.eu>
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 <at> 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 <at> gmx.net>
 	    Stefan Monnier  <monnier <at> 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


This bug report was last modified 10 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.