unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
       [not found]               ` <83imin5l0w.fsf@gnu.org>
@ 2020-03-31  9:20                 ` Robert Pluim
  2020-03-31  9:53                   ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2020-03-31  9:20 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Lars Ingebrigtsen, emacs-devel


(dropping the bug, redirecting to emacs-devel)

>>>>> On Sun, 29 Mar 2020 16:49:03 +0300, Eli Zaretskii <eliz@gnu.org> said:
    >> Yes, that's unfortunate -- the "bind variables as a way of passing in
    >> parameters" thing that Emacs does a lot is a really bad one.  I think
    >> the fix here would be to change open-network-stream, at least, to have a
    >> :coding parameter (and pass it on).

    Eli> Yes, let's do that on master.

Having resisted the strong urge to rip out the gnutls-cli support in
open-network-stream, this turned out to be surprisingly invasive. It
works for nnimap with Gnus for me when passing :coding 'binary instead
of binding coding-system-for-{read-write}, but more testing is
definitely required.

diff --git c/doc/lispref/processes.texi i/doc/lispref/processes.texi
index 4a4f51474c..7d9ca46d94 100644
--- c/doc/lispref/processes.texi
+++ i/doc/lispref/processes.texi
@@ -2462,6 +2462,12 @@ Network
 @item :nowait @var{boolean}
 If non-@code{nil}, try to make an asynchronous connection.
 
+@item :coding @var{coding}
+Use this to set the coding systems used by the network process, in
+preference to binding @code{coding-system-for-read} or
+@code{coding-system-for-write}.  @xref{Network Processes} for
+details.
+
 @item :type @var{type}
 The type of connection.  Options are:
 
diff --git c/etc/NEWS i/etc/NEWS
index 8bbe2aee0b..14bdae3ea7 100644
--- c/etc/NEWS
+++ i/etc/NEWS
@@ -274,6 +274,11 @@ optional argument specifying whether to follow symbolic links.
 ** 'parse-time-string' can now parse ISO 8601 format strings,
 such as "2020-01-15T16:12:21-08:00".
 
+** 'open-network-stream' now accepts a :coding argument.
+This allows specifying the coding systems used by a network process
+for encoding and decoding without having to bind
+coding-system-for-{read,write} or call 'set-process-coding-system'.
+
 \f
 * Changes in Emacs 28.1 on Non-Free Operating Systems
 
diff --git c/lisp/net/gnutls.el i/lisp/net/gnutls.el
index 459156e6d2..171a829f5b 100644
--- c/lisp/net/gnutls.el
+++ i/lisp/net/gnutls.el
@@ -169,8 +169,9 @@ open-gnutls-stream
 Fourth arg SERVICE is the name of the service desired, or an integer
 specifying a port number to connect to.
 Fifth arg PARAMETERS is an optional list of keyword/value pairs.
-Only :client-certificate and :nowait keywords are recognized, and
-have the same meaning as for `open-network-stream'.
+Only :client-certificate, :nowait, and :coding keywords are
+recognized, and have the same meaning as for
+`open-network-stream'.
 For historical reasons PARAMETERS can also be a symbol, which is
 interpreted the same as passing a list containing :nowait and the
 value of that symbol.
@@ -199,16 +200,19 @@ open-gnutls-stream
          (cert (network-stream-certificate host service parameters))
          (keylist (and cert (list cert)))
          (nowait (plist-get parameters :nowait))
-         (process (open-network-stream
-                   name buffer host service
-                   :nowait nowait
-                   :tls-parameters
-                   (and nowait
-                        (cons 'gnutls-x509pki
-                              (gnutls-boot-parameters
-                               :type 'gnutls-x509pki
-                               :keylist keylist
-                               :hostname (puny-encode-domain host)))))))
+         (coding-p (plist-member parameters :coding))
+         (coding-val (plist-get parameters :coding))
+         (args (append (list name buffer host service
+                             :nowait nowait
+                             :tls-parameters
+                             (and nowait
+                                  (cons 'gnutls-x509pki
+                                        (gnutls-boot-parameters
+                                         :type 'gnutls-x509pki
+                                         :keylist keylist
+                                         :hostname (puny-encode-domain host)))))
+                       (when coding-p (list :coding coding-val))))
+         (process (apply #'open-network-stream args)))
     (if nowait
         process
       (gnutls-negotiate :process process
diff --git c/lisp/net/network-stream.el i/lisp/net/network-stream.el
index e99d7a372c..d7d0aedada 100644
--- c/lisp/net/network-stream.el
+++ i/lisp/net/network-stream.el
@@ -113,6 +113,10 @@ open-network-stream
   `ssl'      -- Equivalent to `tls'.
   `shell'    -- A shell connection.
 
+:coding is a symbol or a cons used to specify the coding systems
+used to decode and encode the data which the process reads and
+writes.  See `make-network-process' for details.
+
 :return-list specifies this function's return value.
   If omitted or nil, return a process object.  A non-nil means to
   return (PROC . PROPS), where PROC is a process object and PROPS
@@ -178,18 +182,21 @@ open-network-stream
   (unless (featurep 'make-network-process)
     (error "Emacs was compiled without networking support"))
   (let ((type (plist-get parameters :type))
-	(return-list (plist-get parameters :return-list)))
+	(return-list (plist-get parameters :return-list))
+        (coding-p (plist-member parameters :coding)))
     (if (and (not return-list)
 	     (or (eq type 'plain)
 		 (and (memq type '(nil network))
 		      (not (and (plist-get parameters :success)
 				(plist-get parameters :capability-command))))))
 	;; The simplest case: wrapper around `make-network-process'.
-	(make-network-process :name name :buffer buffer
-			      :host (puny-encode-domain host) :service service
-			      :nowait (plist-get parameters :nowait)
-                              :tls-parameters
-                              (plist-get parameters :tls-parameters))
+        (let ((args (append (list :name name :buffer buffer
+                                  :host (puny-encode-domain host) :service service
+                                  :nowait (plist-get parameters :nowait)
+                                  :tls-parameters
+                                  (plist-get parameters :tls-parameters))
+                            (when coding-p (list :coding (plist-get parameters :coding))))))
+	  (apply #'make-network-process args))
       (let ((work-buffer (or buffer
 			     (generate-new-buffer " *stream buffer*")))
 	    (fun (cond ((and (eq type 'plain)
@@ -245,11 +252,15 @@ 'open-protocol-stream
   "26.1")
 
 (defun network-stream-open-plain (name buffer host service parameters)
-  (let ((start (with-current-buffer buffer (point)))
-	(stream (make-network-process :name name :buffer buffer
-				      :host (puny-encode-domain host)
-                                      :service service
-				      :nowait (plist-get parameters :nowait))))
+  (let* ((start (with-current-buffer buffer (point)))
+         (coding-p (plist-member parameters :coding))
+         (coding-val (plist-get parameters :coding))
+         (args (append (list :name name :buffer buffer
+                             :host (puny-encode-domain host)
+                             :service service
+                             :nowait (plist-get parameters :nowait))
+                       (when coding-p (list :coding coding-val))))
+	 (stream (apply #'make-network-process args)))
     (when (plist-get parameters :warn-unless-encrypted)
       (setq stream (nsm-verify-connection stream host service nil t)))
     (list stream
@@ -267,10 +278,14 @@ network-stream-open-starttls
 	 (eoc                (plist-get parameters :end-of-command))
 	 (eo-capa            (or (plist-get parameters :end-of-capability)
 				 eoc))
+         (coding-p (plist-member parameters :coding))
+         (coding-val (plist-get parameters :coding))
+         (args (append (list :name name :buffer buffer
+                             :host (puny-encode-domain host)
+                             :service service)
+                       (when coding-p (list :coding coding-val))))
 	 ;; Return (STREAM GREETING CAPABILITIES RESULTING-TYPE)
-	 (stream (make-network-process :name name :buffer buffer
-				       :host (puny-encode-domain host)
-                                       :service service))
+         (stream (apply #'make-network-process args))
 	 (greeting (and (not (plist-get parameters :nogreeting))
 			(network-stream-get-response stream start eoc)))
 	 (capabilities (network-stream-command stream capability-command
@@ -348,9 +363,7 @@ network-stream-open-starttls
 	  ;; isn't demanded, reopen an unencrypted connection.
 	  (unless require-tls
 	    (setq stream
-		  (make-network-process :name name :buffer buffer
-					:host (puny-encode-domain host)
-                                        :service service))
+		  (apply #'make-network-process args))
 	    (network-stream-get-response stream start eoc)))
         (unless (process-live-p stream)
           (error "Unable to negotiate a TLS connection with %s/%s"
@@ -453,6 +466,8 @@ network-stream-open-shell
   (let* ((capability-command (plist-get parameters :capability-command))
 	 (eoc 		     (plist-get parameters :end-of-command))
 	 (start (with-current-buffer buffer (point)))
+         (coding-p (plist-member parameters :coding))
+         (coding-val (plist-get parameters :coding))
 	 (stream (let ((process-connection-type nil))
 		   (start-process name buffer shell-file-name
 				  shell-command-switch
@@ -461,6 +476,13 @@ network-stream-open-shell
 				   (format-spec-make
 				    ?s host
 				    ?p service))))))
+    (when coding-p (if (consp coding-val)
+                       (set-process-coding-system stream
+                                                  (car coding-val)
+                                                  (cdr coding-val))
+                     (set-process-coding-system stream
+                                                coding-val
+                                                coding-val)))
     (list stream
 	  (network-stream-get-response stream start eoc)
 	  (network-stream-command stream capability-command



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31  9:20                 ` bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus Robert Pluim
@ 2020-03-31  9:53                   ` Andreas Schwab
  2020-03-31 10:16                     ` Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2020-03-31  9:53 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, Lars Ingebrigtsen, emacs-devel

On Mär 31 2020, Robert Pluim wrote:

> @@ -245,11 +252,15 @@ 'open-protocol-stream
>    "26.1")
>  
>  (defun network-stream-open-plain (name buffer host service parameters)
> -  (let ((start (with-current-buffer buffer (point)))
> -	(stream (make-network-process :name name :buffer buffer
> -				      :host (puny-encode-domain host)
> -                                      :service service
> -				      :nowait (plist-get parameters :nowait))))
> +  (let* ((start (with-current-buffer buffer (point)))
> +         (coding-p (plist-member parameters :coding))
> +         (coding-val (plist-get parameters :coding))
> +         (args (append (list :name name :buffer buffer
> +                             :host (puny-encode-domain host)
> +                             :service service
> +                             :nowait (plist-get parameters :nowait))
> +                       (when coding-p (list :coding coding-val))))
> +	 (stream (apply #'make-network-process args)))

You don't need to use apply.  Since :coding nil is the same as the
default, you can just pass `:coding (plist-get parameters :coding)'
unconditionally.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31  9:53                   ` Andreas Schwab
@ 2020-03-31 10:16                     ` Robert Pluim
  2020-03-31 10:31                       ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2020-03-31 10:16 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, Lars Ingebrigtsen, emacs-devel

>>>>> On Tue, 31 Mar 2020 11:53:36 +0200, Andreas Schwab <schwab@linux-m68k.org> said:

    Andreas> On Mär 31 2020, Robert Pluim wrote:
    >> @@ -245,11 +252,15 @@ 'open-protocol-stream
    >> "26.1")
    >> 
    >> (defun network-stream-open-plain (name buffer host service parameters)
    >> -  (let ((start (with-current-buffer buffer (point)))
    >> -	(stream (make-network-process :name name :buffer buffer
    >> -				      :host (puny-encode-domain host)
    >> -                                      :service service
    >> -				      :nowait (plist-get parameters :nowait))))
    >> +  (let* ((start (with-current-buffer buffer (point)))
    >> +         (coding-p (plist-member parameters :coding))
    >> +         (coding-val (plist-get parameters :coding))
    >> +         (args (append (list :name name :buffer buffer
    >> +                             :host (puny-encode-domain host)
    >> +                             :service service
    >> +                             :nowait (plist-get parameters :nowait))
    >> +                       (when coding-p (list :coding coding-val))))
    >> +	 (stream (apply #'make-network-process args)))

    Andreas> You don't need to use apply.  Since :coding nil is the same as the
    Andreas> default, you can just pass `:coding (plist-get parameters :coding)'
    Andreas> unconditionally.

My reading of set_network_socket_coding_system is that having a plist
in make-network-process with :coding nil overrides a non-nil
coding-system-for-{read-write}, which I donʼt think we want.

Robert



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31 10:16                     ` Robert Pluim
@ 2020-03-31 10:31                       ` Andreas Schwab
  2020-03-31 11:09                         ` Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2020-03-31 10:31 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, Lars Ingebrigtsen, emacs-devel

On Mär 31 2020, Robert Pluim wrote:

> My reading of set_network_socket_coding_system is that having a plist
> in make-network-process with :coding nil overrides a non-nil
> coding-system-for-{read-write}, which I donʼt think we want.

You are right, make-network-process and make-serial-process handle that
differently than make-process and make-pipe-process.  I think this is a
bug, they should all handle :coding nil the same (same as absence).

But in any case, your patch can be simplyfied:

--- a/lisp/net/network-stream.el
+++ b/lisp/net/network-stream.el
@@ -246,10 +246,12 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
 
 (defun network-stream-open-plain (name buffer host service parameters)
   (let ((start (with-current-buffer buffer (point)))
-	(stream (make-network-process :name name :buffer buffer
-				      :host (puny-encode-domain host)
-                                      :service service
-				      :nowait (plist-get parameters :nowait))))
+	(stream (apply #'make-network-process :name name :buffer buffer
+		       :host (puny-encode-domain host)
+                       :service service
+		       :nowait (plist-get parameters :nowait)
+                       (if (plist-member parameters :coding)
+                           (list :coding (plist-get parameters :coding))))))
     (when (plist-get parameters :warn-unless-encrypted)
       (setq stream (nsm-verify-connection stream host service nil t)))
     (list stream

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31 10:31                       ` Andreas Schwab
@ 2020-03-31 11:09                         ` Robert Pluim
  2020-03-31 16:13                           ` Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2020-03-31 11:09 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, Lars Ingebrigtsen, emacs-devel

>>>>> On Tue, 31 Mar 2020 12:31:04 +0200, Andreas Schwab <schwab@linux-m68k.org> said:

    Andreas> On Mär 31 2020, Robert Pluim wrote:
    >> My reading of set_network_socket_coding_system is that having a plist
    >> in make-network-process with :coding nil overrides a non-nil
    >> coding-system-for-{read-write}, which I donʼt think we want.

    Andreas> You are right, make-network-process and make-serial-process handle that
    Andreas> differently than make-process and make-pipe-process.  I think this is a
    Andreas> bug, they should all handle :coding nil the same (same as absence).

I think I agree with that. Basically this, initially (and the same for
make-serial-process)

diff --git a/src/process.c b/src/process.c
index e18a5aa538..b00d8e1cfe 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3261,9 +3262,7 @@ set_network_socket_coding_system (Lisp_Object proc, Lisp_Object host,
   Lisp_Object coding_systems = Qt;
   Lisp_Object val;
 
-  tem = Fplist_member (contact, QCcoding);
-  if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
-    tem = Qnil;  /* No error message (too late!).  */
+  tem = Fplist_get (contact, QCcoding);
 
   /* Setup coding systems for communicating with the network stream.  */
   /* Qt denotes we have not yet called Ffind_operation_coding_system.  */

    Andreas> But in any case, your patch can be simplyfied:

    Andreas> --- a/lisp/net/network-stream.el
    Andreas> +++ b/lisp/net/network-stream.el
    Andreas> @@ -246,10 +246,12 @@ gnutls-boot (as returned by `gnutls-boot-parameters')."
 
    Andreas>  (defun network-stream-open-plain (name buffer host service parameters)
    Andreas>    (let ((start (with-current-buffer buffer (point)))
    Andreas> -	(stream (make-network-process :name name :buffer buffer
    Andreas> -				      :host (puny-encode-domain host)
    Andreas> -                                      :service service
    Andreas> -				      :nowait (plist-get parameters :nowait))))
    Andreas> +	(stream (apply #'make-network-process :name name :buffer buffer
    Andreas> +		       :host (puny-encode-domain host)
    Andreas> +                       :service service
    Andreas> +		       :nowait (plist-get parameters :nowait)
    Andreas> +                       (if (plist-member parameters :coding)
    Andreas> +                           (list :coding (plist-get parameters :coding))))))
    Andreas>      (when (plist-get parameters :warn-unless-encrypted)
    Andreas>        (setq stream (nsm-verify-connection stream host service nil t)))
    Andreas>      (list stream

Sure.

Robert



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31 11:09                         ` Robert Pluim
@ 2020-03-31 16:13                           ` Robert Pluim
  2020-03-31 17:59                             ` Eli Zaretskii
  2020-04-02 11:10                             ` Lars Ingebrigtsen
  0 siblings, 2 replies; 12+ messages in thread
From: Robert Pluim @ 2020-03-31 16:13 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: Eli Zaretskii, Lars Ingebrigtsen, emacs-devel

>>>>> On Tue, 31 Mar 2020 13:09:14 +0200, Robert Pluim <rpluim@gmail.com> said:

>>>>> On Tue, 31 Mar 2020 12:31:04 +0200, Andreas Schwab <schwab@linux-m68k.org> said:
    Andreas> On Mär 31 2020, Robert Pluim wrote:
    >>> My reading of set_network_socket_coding_system is that having a plist
    >>> in make-network-process with :coding nil overrides a non-nil
    >>> coding-system-for-{read-write}, which I donʼt think we want.

    Andreas> You are right, make-network-process and make-serial-process handle that
    Andreas> differently than make-process and make-pipe-process.  I think this is a
    Andreas> bug, they should all handle :coding nil the same (same as absence).

    Robert> I think I agree with that. Basically this, initially (and the same for
    Robert> make-serial-process)

Now that Iʼve actually tested it, the change looks like this, making
make-network-process and make-serial process behave the same as
make-process and make-pipe-process. Iʼve looked at all uses of those
two functions in Emacs' sources, and none of them depend on the change
in semantics, in fact only a couple of them actually pass a :coding
keyword.

Having said all that, this does go back a looooong way (2002 at
least), so maybe we want to let sleeping dogs lie.

diff --git a/src/process.c b/src/process.c
index e18a5aa538..2db45b18b2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3205,14 +3206,12 @@ DEFUN ("make-serial-process", Fmake_serial_process, Smake_serial_process,
 		       BUF_ZV_BYTE (XBUFFER (buffer)));
     }
 
-  tem = Fplist_member (contact, QCcoding);
-  if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
-    tem = Qnil;
+  tem = Fplist_get (contact, QCcoding);
 
   val = Qnil;
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
 	val = XCAR (val);
     }
@@ -3226,7 +3225,7 @@ DEFUN ("make-serial-process", Fmake_serial_process, Smake_serial_process,
   val = Qnil;
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
 	val = XCDR (val);
     }
@@ -3261,16 +3260,14 @@ set_network_socket_coding_system (Lisp_Object proc, Lisp_Object host,
   Lisp_Object coding_systems = Qt;
   Lisp_Object val;
 
-  tem = Fplist_member (contact, QCcoding);
-  if (!NILP (tem) && (!CONSP (tem) || !CONSP (XCDR (tem))))
-    tem = Qnil;  /* No error message (too late!).  */
+  tem = Fplist_get (contact, QCcoding);
 
   /* Setup coding systems for communicating with the network stream.  */
   /* Qt denotes we have not yet called Ffind_operation_coding_system.  */
 
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
 	val = XCAR (val);
     }
@@ -3304,7 +3301,7 @@ set_network_socket_coding_system (Lisp_Object proc, Lisp_Object host,
 
   if (!NILP (tem))
     {
-      val = XCAR (XCDR (tem));
+      val = tem;
       if (CONSP (val))
 	val = XCDR (val);
     }



^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31 16:13                           ` Robert Pluim
@ 2020-03-31 17:59                             ` Eli Zaretskii
  2020-03-31 19:53                               ` Robert Pluim
  2020-04-02 11:10                             ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2020-03-31 17:59 UTC (permalink / raw)
  To: Robert Pluim; +Cc: larsi, schwab, emacs-devel

> From: Robert Pluim <rpluim@gmail.com>
> Cc: Eli Zaretskii <eliz@gnu.org>,  Lars Ingebrigtsen <larsi@gnus.org>,
>   emacs-devel@gnu.org
> Date: Tue, 31 Mar 2020 18:13:10 +0200
> 
> Now that Iʼve actually tested it, the change looks like this, making
> make-network-process and make-serial process behave the same as
> make-process and make-pipe-process. Iʼve looked at all uses of those
> two functions in Emacs' sources, and none of them depend on the change
> in semantics, in fact only a couple of them actually pass a :coding
> keyword.

Nevertheless, we should call out this change in NEWS.

> Having said all that, this does go back a looooong way (2002 at
> least), so maybe we want to let sleeping dogs lie.

I don't think this is a risky change.  Programs that assume what we
currently do rely on undefined behavior, IMO.

Thanks.



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31 17:59                             ` Eli Zaretskii
@ 2020-03-31 19:53                               ` Robert Pluim
  0 siblings, 0 replies; 12+ messages in thread
From: Robert Pluim @ 2020-03-31 19:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: larsi, schwab, emacs-devel

>>>>> On Tue, 31 Mar 2020 20:59:01 +0300, Eli Zaretskii <eliz@gnu.org> said:

    >> From: Robert Pluim <rpluim@gmail.com>
    >> Cc: Eli Zaretskii <eliz@gnu.org>,  Lars Ingebrigtsen <larsi@gnus.org>,
    >> emacs-devel@gnu.org
    >> Date: Tue, 31 Mar 2020 18:13:10 +0200
    >> 
    >> Now that Iʼve actually tested it, the change looks like this, making
    >> make-network-process and make-serial process behave the same as
    >> make-process and make-pipe-process. Iʼve looked at all uses of those
    >> two functions in Emacs' sources, and none of them depend on the change
    >> in semantics, in fact only a couple of them actually pass a :coding
    >> keyword.

    Eli> Nevertheless, we should call out this change in NEWS.

That goes without saying. Probably put a note somewhere in the elisp
manual as well.

    >> Having said all that, this does go back a looooong way (2002 at
    >> least), so maybe we want to let sleeping dogs lie.

    Eli> I don't think this is a risky change.  Programs that assume what we
    Eli> currently do rely on undefined behavior, IMO.

Well, itʼs not undefined in the 'C' sense of undefined at least :-)

Iʼll finish it up, and then convert at least Gnus over to use it.

Robert



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-03-31 16:13                           ` Robert Pluim
  2020-03-31 17:59                             ` Eli Zaretskii
@ 2020-04-02 11:10                             ` Lars Ingebrigtsen
  2020-04-02 12:48                               ` Robert Pluim
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2020-04-02 11:10 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, Andreas Schwab, emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

> Now that Iʼve actually tested it, the change looks like this, making
> make-network-process and make-serial process behave the same as
> make-process and make-pipe-process. Iʼve looked at all uses of those
> two functions in Emacs' sources, and none of them depend on the change
> in semantics, in fact only a couple of them actually pass a :coding
> keyword.
>
> Having said all that, this does go back a looooong way (2002 at
> least), so maybe we want to let sleeping dogs lie.

Yeah, it does sound slightly scary, but I think the current nil
behaviour for :coding is probably not something any code would rely
on...  I'm not quite sure what `nil' semantics for :coding here would
signify?

On the other hand, I generally think that functions should respect their
parameters, so if you say :coding nil, it might then be somewhat
surprising that `coding-system-for-{read,write}' are used instead?

So I'm not quite sure that the current make-network-process behaviour
here is a bug.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-04-02 11:10                             ` Lars Ingebrigtsen
@ 2020-04-02 12:48                               ` Robert Pluim
  2020-04-03 11:52                                 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Robert Pluim @ 2020-04-02 12:48 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, Andreas Schwab, emacs-devel

>>>>> On Thu, 02 Apr 2020 13:10:37 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> Robert Pluim <rpluim@gmail.com> writes:
    >> Now that Iʼve actually tested it, the change looks like this, making
    >> make-network-process and make-serial process behave the same as
    >> make-process and make-pipe-process. Iʼve looked at all uses of those
    >> two functions in Emacs' sources, and none of them depend on the change
    >> in semantics, in fact only a couple of them actually pass a :coding
    >> keyword.
    >> 
    >> Having said all that, this does go back a looooong way (2002 at
    >> least), so maybe we want to let sleeping dogs lie.

    Lars> Yeah, it does sound slightly scary, but I think the current nil
    Lars> behaviour for :coding is probably not something any code would rely
    Lars> on...  I'm not quite sure what `nil' semantics for :coding here would
    Lars> signify?

No code in Emacs that I could find relies on it. The new semantics
would be 'use coding-system-for-read', which I think is defensible.

    Lars> On the other hand, I generally think that functions should respect their
    Lars> parameters, so if you say :coding nil, it might then be somewhat
    Lars> surprising that `coding-system-for-{read,write}' are used instead?

    Lars> So I'm not quite sure that the current make-network-process behaviour
    Lars> here is a bug.

Itʼs different from make-process and make-pipe-process, itʼs
undocumented, and it was surprising to both me and Andreas. If it
turns out that in some obscure case somebody really needs the old
behaviour, then binding coding-system-for-{read,write} will still be
available, as will set-process-coding-sytem (or even passing :coding
'(nil nil), but thatʼs just evil :-) )

Robert



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-04-02 12:48                               ` Robert Pluim
@ 2020-04-03 11:52                                 ` Lars Ingebrigtsen
  2020-04-03 12:50                                   ` Robert Pluim
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2020-04-03 11:52 UTC (permalink / raw)
  To: Robert Pluim; +Cc: Eli Zaretskii, Andreas Schwab, emacs-devel

Robert Pluim <rpluim@gmail.com> writes:

> Itʼs different from make-process and make-pipe-process, itʼs
> undocumented, and it was surprising to both me and Andreas.

Yeah, that's a good reason for changing it.

> If it turns out that in some obscure case somebody really needs the
> old behaviour, then binding coding-system-for-{read,write} will still
> be available, as will set-process-coding-sytem (or even passing
> :coding '(nil nil), but thatʼs just evil :-) )

Oh, yeah.  :-)  Then I don't have any quibbles about your patch.

I don't think that's evil at all, though -- it should be mentioned in
NEWS that if somebody (for some odd, unlikely reason) wants the old
:coding nil behaviour, then they should say :coding '(nil nil) now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus
  2020-04-03 11:52                                 ` Lars Ingebrigtsen
@ 2020-04-03 12:50                                   ` Robert Pluim
  0 siblings, 0 replies; 12+ messages in thread
From: Robert Pluim @ 2020-04-03 12:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: Eli Zaretskii, Andreas Schwab, emacs-devel

>>>>> On Fri, 03 Apr 2020 13:52:06 +0200, Lars Ingebrigtsen <larsi@gnus.org> said:

    Lars> Robert Pluim <rpluim@gmail.com> writes:
    >> Itʼs different from make-process and make-pipe-process, itʼs
    >> undocumented, and it was surprising to both me and Andreas.

    Lars> Yeah, that's a good reason for changing it.

    >> If it turns out that in some obscure case somebody really needs the
    >> old behaviour, then binding coding-system-for-{read,write} will still
    >> be available, as will set-process-coding-sytem (or even passing
    >> :coding '(nil nil), but thatʼs just evil :-) )

    Lars> Oh, yeah.  :-)  Then I don't have any quibbles about your patch.

    Lars> I don't think that's evil at all, though -- it should be mentioned in
    Lars> NEWS that if somebody (for some odd, unlikely reason) wants the old
    Lars> :coding nil behaviour, then they should say :coding '(nil nil) now.

Ok, pushed to master as d08e81ce5a , with that in NEWS.

Iʼll hold off on the :coding change to open-network-stream et al for
the moment, just in case this does break something.

Robert



^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-04-03 12:50 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <86bloi1zrj.fsf@csic.es>
     [not found] ` <83lfnm8b30.fsf@gnu.org>
     [not found]   ` <83ftdt9b1d.fsf@gnu.org>
     [not found]     ` <86sght3h1s.fsf@csic.es>
     [not found]       ` <834ku89anf.fsf@gnu.org>
     [not found]         ` <87a740ub2r.fsf@gnus.org>
     [not found]           ` <83tv287s9j.fsf@gnu.org>
     [not found]             ` <874ku7txho.fsf@gnus.org>
     [not found]               ` <83imin5l0w.fsf@gnu.org>
2020-03-31  9:20                 ` bug#40248: 27.0.90; Failure open .authinfo.gpg from Gnus Robert Pluim
2020-03-31  9:53                   ` Andreas Schwab
2020-03-31 10:16                     ` Robert Pluim
2020-03-31 10:31                       ` Andreas Schwab
2020-03-31 11:09                         ` Robert Pluim
2020-03-31 16:13                           ` Robert Pluim
2020-03-31 17:59                             ` Eli Zaretskii
2020-03-31 19:53                               ` Robert Pluim
2020-04-02 11:10                             ` Lars Ingebrigtsen
2020-04-02 12:48                               ` Robert Pluim
2020-04-03 11:52                                 ` Lars Ingebrigtsen
2020-04-03 12:50                                   ` Robert Pluim

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).