unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Tassilo Horn <tsdh@gnu.org>
Cc: 53360@debbugs.gnu.org
Subject: bug#53360: 29.0.50; Tramp/AngeFTP/Dired: Error about wrong ls usage when connecting to FTP server
Date: Sun, 06 Feb 2022 18:08:44 +0100	[thread overview]
Message-ID: <87mtj3ly77.fsf@gmx.de> (raw)
In-Reply-To: <87v8yggczz.fsf@shd.de> (Tassilo Horn's message of "Wed, 19 Jan 2022 12:40:03 +0100")

[-- Attachment #1: Type: text/plain, Size: 826 bytes --]

Tassilo Horn <tsdh@gnu.org> writes:

Hi Tassilo,

> I've tried to connect to some FTP server using
>
>   C-x C-f /ftp:user@server.com: RET
>
> and got this usage error in the *ftp* buffer:
>
> ftp> ls -alh --group-directories-first /tmp/ange-ftpbNvAjx
> usage: ls remote-directory local-file
> ftp>
>
> I think those unrecognized arguments like --group-directories-first come
> due to the fact that I've set
>
>   (setq dired-listing-switches "-alh --group-directories-first")
>
> which is fine for normal dired but not FTP.
>
> I guess in the FTP case, there must be some dired-listing-switches
> sanitization, i.e., remove those options which are not valid for FTP.
> (I wouldn't care if it hard-coded the standard "-ah" for now.)

Could you pls check whether the appended patch fixes this for you?

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1754 bytes --]

*** /tmp/ediffKwDzst	2022-02-06 18:04:22.926235692 +0100
--- /home/albinus/src/emacs/lisp/net/ange-ftp.el	2022-02-06 18:01:52.895457683 +0100
***************
*** 2547,2559 ****
  (defvar ange-ftp-after-parse-ls-hook nil
    "Normal hook run after parsing the text of an FTP directory listing.")

  (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)))
    ;; 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))
--- 2547,2562 ----
  (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."
!   (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	other threads:[~2022-02-06 17:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-19 11:40 bug#53360: 29.0.50; Tramp/AngeFTP/Dired: Error about wrong ls usage when connecting to FTP server Tassilo Horn
2022-02-06 17:08 ` Michael Albinus [this message]
2022-02-06 20:05   ` Tassilo Horn
2022-02-07  9:09     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtj3ly77.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=53360@debbugs.gnu.org \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).