Subject: bug#67865: closed (Re: bug#67865: [PATCH] ange-ftp fails with tnftp client)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 18 Dec 2023 10:17:02 +0000

Your bug report

#67865: [PATCH] ange-ftp fails with tnftp client

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
67865: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=67865
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#67865: [PATCH] ange-ftp fails with tnftp client
From: Michael Albinus <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked], [email-masked]
Date: Mon, 18 Dec 2023 11:16:10 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 29.2

Eli Zaretskii <[email-masked]> writes:

Hi,

>> > I suggest slightly changing the regexp used in string-match to allow
>> > for this colon, as shown below:
>> >
>> > (defun ange-ftp-passive-mode (proc on-or-off)
>> >   (if (string-match (concat "Passive mode:? " on-or-off)
>> >   [...]
>> >
>> > The attached patch does just that.
>>
>> Looks OK to me.
>>
>> Eli, do we want this in emacs-29 or master?
>
> It's okay to install this on emacs-29, thanks.

Done, closing the bug.

Best regards, Michael.

Subject: [PATCH] ange-ftp fails with tnftp client
From: Christophe Deleuze <[email-masked]>
To: [email-masked]
Date: Sun, 17 Dec 2023 14:56:57 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

* bug description

When used with the tnftp client (https://en.wikipedia.org/wiki/Tnftp),
ange-ftp fails when trying to enable passive mode.

* fix description

Passive mode is enabled by function ange-ftp-passive-mode:

(defun ange-ftp-passive-mode (proc on-or-off)
  (if (string-match (concat "Passive mode " on-or-off)
                    (cdr (ange-ftp-raw-send-cmd
                          proc (concat "passive " on-or-off)
                          "Trying passive mode..." nil)))
      (ange-ftp-message (concat "Trying passive mode..." on-or-off))
    (error "Trying passive mode...failed")))

that expects to get a result string containing the string "Passive
mode on" (when on-or-off is "on"), however tnftp includes a colon in
its answer (extract from the buffer the ftp process is run in):

ftp> passive on
Passive mode: on; fallback to active mode: off.

I suggest slightly changing the regexp used in string-match to allow
for this colon, as shown below:

(defun ange-ftp-passive-mode (proc on-or-off)
  (if (string-match (concat "Passive mode:? " on-or-off)
  [...]
  
The attached patch does just that.

For information, in debian bookworm the ftp package has changed from
netkit-ftp to being a dummy transitional package for tnftp.

regards,

>From 1f41c0b474b7cc731aa4824902199c13bd15c895 Mon Sep 17 00:00:00 2001
From: Christophe Deleuze <[email-masked]>
Date: Sun, 17 Dec 2023 14:49:27 +0100
Subject: [PATCH] ange-ftp: fix passive mode result string for tntfp client

---
 lisp/net/ange-ftp.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 4e4db34a78d..a1eb57baa20 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -2164,7 +2164,7 @@ ange-ftp-get-process
       proc)))
 
 (defun ange-ftp-passive-mode (proc on-or-off)
-  (if (string-match (concat "Passive mode " on-or-off)
+  (if (string-match (concat "Passive mode:? " on-or-off)
                     (cdr (ange-ftp-raw-send-cmd
                           proc (concat "passive " on-or-off)
                           "Trying passive mode..." nil)))
-- 
2.39.2