Subject: bug#23540: 25.1.50; make-ipv4-tcp-server-with-unspecified-port fails

From: Eli Zaretskii <[email-masked]>
Date: Sun, 15 May 2016 19:15:22 +0300

> From: Ken Brown <[email-masked]>
> Date: Sun, 15 May 2016 08:16:34 -0400
> Cc: Lars Ingebrigtsen <[email-masked]>
> 
> On 5/14/2016 9:36 PM, Ken Brown wrote:
> > Commit b73e525, as corrected by commit 4639bc9, causes the test
> > make-ipv4-tcp-server-with-unspecified-port in
> > test/lisp/net/network-streams-tests.el to fail with the error
> >
> >   Invalid argument 4 of operation `open-network-stream'.
> >
> > What happens is that make-network-process calls
> > set_network_socket_coding_system, which calls open-network-stream with
> > service eq t, which leads to the error in a way that I haven't sorted out.
> 
> I didn't get that last step right.  The error is generated by 
> Ffind_operation_coding_system when it is called by
> 
> CALLN (Ffind_operation_coding_system,
> 	Qopen_network_stream, name, p->buffer,
> 	host, service)
> 
> in set_network_socket_coding_system.

Ffind_operation_coding_system includes an explicit test for the 4th
argument to be an integer:

  if (!(STRINGP (target)
	|| (EQ (operation, Qinsert_file_contents) && CONSP (target)
	    && STRINGP (XCAR (target)) && BUFFERP (XCDR (target)))
	|| (EQ (operation, Qopen_network_stream) && INTEGERP (target))))
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    error ("Invalid argument %"pI"d of operation `%s'",
	   XFASTINT (target_idx) + 1, SDATA (SYMBOL_NAME (operation)));

This should obviously be augmented, now that the value can also be t.