Subject: Re: bug#49055: 28.0.50; [PATCH] De-obfuscate gnutls_handshake loop

From: Eli Zaretskii <[email-masked]>
Date: Sat, 19 Jun 2021 16:47:58 +0300

> From: Lars Ingebrigtsen <[email-masked]>
> Cc: [email-masked],  [email-masked]
> Date: Sat, 19 Jun 2021 15:40:19 +0200
> 
> Eli Zaretskii <[email-masked]> writes:
> 
> >> I think that makes sense, so I've now applied your patch to Emacs 28.
> >
> > The code wasn't really 100% equivalent, though.
> 
> No -- it looped in two different ways, but staring at the code, I
> convinced myself that it should be functionally equivalent.
> 
> I may be misreading the code, though.

What bothers me:

  . the gnutls_error_is_fatal call is missing from the new code
  . the negative values of 'ret' (if they are significant) aren't
    tested anymore
  . the condition of GNUTLS_E_INTERRUPTED is tested only once, and
    immediately causes the outer while-loop to be abandoned

I'd love to see some rationale for these differences.  For example,
the last difference seems to have a potential of causing failure of
handshaking if the user happens to type some input (in GUI sessions),
or C-g in text-mode sessions, at some opportune moment.