Subject: bug#43695: 28.0.50; FTP tramp fails with some dired listing switches

From: Jean Louis <[email-masked]>
Date: Wed, 30 Sep 2020 14:06:41 +0300

* Michael Albinus <[email-masked]> [2020-09-29 21:01]:
> Jean Louis <[email-masked]> writes:
> 
> Hi Jean,
> 
> > So I think that my dired switches like "-gohl
> > --group-directories-first" are disturbing the FTP.
> >
> > Maybe special switches shall be used for FTP and special for dired, so
> > that such do not conflict.
> 
> ange-ftp has already a check for proper dired switches. Does the
> appended patch fixes your problem?
> 
> > Jean
> 
> Best regards, Michael.
> 

> *** /tmp/ediffSNrsg5	2020-09-29 19:59:25.357750430 +0200
> --- /home/albinus/src/emacs/lisp/net/ange-ftp.el	2020-09-29 19:59:09.169756302 +0200
> ***************
> *** 2835,2840 ****
> --- 2835,2843 ----
>          ;; Disallow recursive flag.
>          (not (string-match
>                "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
> +        ;; Disallow do not list owner flag.  (Bug#43695)
> +        (not (string-match
> +              "\\(\\`\\| \\)-[[:alpha:]]*g" switches))
>          switches))
> 
>   (defun ange-ftp-get-files (directory &optional no-error)

As I cannot implement your patch easily and directly, I would just
like to re-define the function, is it this one? Please send me your
function in complete, that I can try it out.

(defun ange-ftp-switches-ok (switches)
  "Return SWITCHES (a string) if suitable for use with ls over ftp."
  (and (stringp switches)
       ;; We allow the --almost-all 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)
       ;; Disallow other long flags except --(almost-)all.
       (not (string-match "\\(\\`\\| \\)--\\w+"
                          (replace-regexp-in-string
                           "--\\(almost-\\)?all\\>" ""
                           switches)))
       ;; Must include 'l'.
       (string-match "\\(\\`\\| \\)-[[:alpha:]]*l" switches)
       ;; Disallow recursive flag.
       (not (string-match
             "\\(\\`\\| \\)-[[:alpha:]]*R" switches))
       switches))