Subject: Re: bug#33050: 27.0.50; [macOS] Problem with process input with process-connection-type nil

From: Thomas Fitzsimmons <[email-masked]>
Date: Tue, 23 Oct 2018 21:55:13 -0400

Filipp Gunbin <[email-masked]> writes:

> Thomas,
>
> On 22/10/2018 21:53 -0400, Thomas Fitzsimmons wrote:
> [..]
>> As for that specific line, I may have copied it from another part of
>> Emacs that reads a password via a pipe; when I look now at other places
>> that bind this variable to nil, I see comments like this one in
>> lisp/gnus/nntp.el:
>>
>>     ;; A non-nil connection type results in mightily odd behavior where
>>     ;; (process-send-string proc "\^M") ends up sending a "\n" to the
>>     ;; ssh process.  --Stef
>>     ;; Also a nil connection allow ssh-askpass to work under X11.
>>     (let ((process-connection-type nil))
>>       (apply 'start-process "nntpd" buffer command))
>>
>> Today I tested my setup (x86_64 GNU/Linux, OpenLDAP ldapsearch 2.4.40)
>> without setting process-connection-type to nil, and it still works.  The
>> documentation for that variable says that the fallback is to use a pipe
>> if all ptys are busy in which case I guess this would still fail for
>> you.
>>
>> Your test case behaves the same way for me on x86_64 GNU/Linux.
>
> Do you mean it fails, or it works ok (regardless of
> process-connection-type value)?

I meant its behaviour is the same for me on x86_64 GNU/Linux as what you
described its behaviour to be on Mac OS.  Without:

(process-connection-type nil)

the test case succeeds.  With it, the test case hangs.

However if I change the test case program from:

"/usr/bin/read" "-p" "enter something:"

to:

"ldapsearch" "-W"

it does not hang regardless of the process-connection-type setting.
Because it is missing the other options, after reading the password
ldapsearch just fails to contact the server, after which my-process-buf
contains...

...without (process-connection-type nil)):

   Enter LDAP Password: 
   ldap_sasl_interactive_bind_s: can't contact LDAP server (-1)
   
   Process my-process<4> exited abnormally with code 255

...with (process-connection-type nil)):

   Enter LDAP Password: ldap_sasl_interactive_bind_s: can't contact LDAP server (-1)
   
   Process my-process<4> exited abnormally with code 255

The only difference seems to be the missing newline.

I got the above results with both my system ldapsearch (2.4.40) and with
ldapseach 2.4.28 which I built from source.

Anyway, at least on my system, it seems that /usr/bin/read is not doing
the same thing as ldapsearch -W to read the string.

What happens when you try the test case with "ldapsearch" "-W"?

>> Maybe our ldapsearch commands are behaving differently.  What version of
>> ldapsearch are you using?
>
> I have OpenLDAP 2.4.28.

OK, I doubt the problem is related to OpenLDAP version differences, but
if it's easy it might be worth trying a newer one.

Thomas