Subject: Re: bug#48494: 28.0.50; [PATCH] AngeFTP fails on macOS 10.14 with GNU inetutils FTP

From: Alex Bochannek <[email-masked]>
Date: Tue, 18 May 2021 10:50:25 -0700

Eli Zaretskii <[email-masked]> writes:

>> From: Alex Bochannek <[email-masked]>
>> Date: Mon, 17 May 2021 20:53:41 -0700
>> 
>> There is no -e option for Windows FTP and ftp will terminate when
>> receiving an unknown option (tested version Windows 10.0.19042.928)
>> 
>> There is no -e option in Solaris FTP and I cannot test how it responds
>> to an unknown option.
>> 
>> I am proposing the below patch which resolves the problem on macOS with
>> GNU inetutils and does no harm for Netkit-ftp/lukemftp/tnftp.
>> 
>> However, because of the way a Windows client would respond, I am open to
>> different approaches including considering this an inetutils bug
>> instead.
>
> How about making the default value depend on the value of system-type?

You mean something like this?

diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index 04ea809127..61a0f09f43 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -947,8 +947,13 @@ ange-ftp-gateway-ftp-program-name
 Some AT&T folks claim to use something called `pftp' here."
   :group 'ange-ftp
   :type 'string)
+(defcustom imap-read-timeout (if (memq system-type '(windows-nt cygwin))
+				 1.0
+			       0.1)
 
-(defcustom ange-ftp-ftp-program-args '("-i" "-n" "-g" "-v")
+(defcustom ange-ftp-ftp-program-args (if (eq system-type 'darwin)
+  '("-i" "-n" "-g" "-v" "-e") ; for GNU inetutils
+  '("-i" "-n" "-g" "-v"))
   "A list of arguments passed to the FTP program when started."
   :group 'ange-ftp
   :type '(repeat string))

The more I think about it, the more I am leaning against changing the
default. I don't fully understand what inetutils ftp is doing and why -e
is needed. Maybe submitting a bug against inetutils is the right
approach here?

As an aside (and why a system-type switch may be needed anyway), it
looks to me that -v means the exact opposite thing on Windows than what
is expected:

BSD/Netkit/Inetutils/Solaris/HP-UX/AIX all specify that -v is verbose
and that it's the default for interactive sessions.

tnftp has a -V option that turns off verbose mode. Inetutils has a -V
for --version.

Windows however does this:

-v 	Suppresses display of remote server responses.

(Verified on Windows 10.0.19042.928)

It seems to me that -v should be removed for Windows and likely can be
removed for all systems. I haven't used Cygwin in a while, but I suspect
AngeFTP can use either the Windows or the Inetutils FTP.

Are there any automated cross-platform tests to see on which platform
removing -v might break AngeFTP?

-- 
Alex.