From mboxrd@z Thu Jan  1 00:00:00 1970
Path: news.gmane.org!.POSTED!not-for-mail
From: Andy Moreton <andrewjmoreton@gmail.com>
Newsgroups: gmane.emacs.bugs
Subject: bug#25061: consider adding %COMPAT to default gnutls priority string
Date: Wed, 20 Dec 2017 13:16:34 +0000
Message-ID: <vz1ind15ykt.fsf@gmail.com>
References: <87zikiwpl6.fsf@igalia.com>
	<CAFyQvY2W4ciqX+RbQfC5VRX+ouxoARYLx5YQvcc+q_hKE7+QOg@mail.gmail.com>
	<87shc6k3tf.fsf@lifelogs.com>
	<CAFyQvY02a=ZZZyzH3FSkOYSAPDpwzVhxUR9Qa3QO9-2gTwEG+w@mail.gmail.com>
	<87bmiujjdg.fsf@lifelogs.com> <vz1d139k19m.fsf@gmail.com>
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: text/plain
X-Trace: blaine.gmane.org 1513775781 22430 195.159.176.226 (20 Dec 2017 13:16:21 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 20 Dec 2017 13:16:21 +0000 (UTC)
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)
To: 25061@debbugs.gnu.org
Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Dec 20 14:16:17 2017
Return-path: <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Envelope-to: geb-bug-gnu-emacs@m.gmane.org
Original-Received: from lists.gnu.org ([208.118.235.17])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1eReEI-0005Hk-O3
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Dec 2017 14:16:14 +0100
Original-Received: from localhost ([::1]:51209 helo=lists.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>)
	id 1eReGH-00039L-1c
	for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Dec 2017 08:18:17 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53303)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1eReG7-00037O-0H
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:18:08 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1eReG2-0003bb-Rm
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:18:06 -0500
Original-Received: from debbugs.gnu.org ([208.118.235.43]:34593)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
	id 1eReG2-0003bC-Na
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:18:02 -0500
Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
	(envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1eReG2-00077m-F7
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:18:02 -0500
X-Loop: help-debbugs@gnu.org
In-Reply-To: <87zikiwpl6.fsf@igalia.com>
Resent-From: Andy Moreton <andrewjmoreton@gmail.com>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@gnu.org
Resent-Date: Wed, 20 Dec 2017 13:18:02 +0000
Resent-Message-ID: <handler.25061.B.151377583427331@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 25061
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
X-Debbugs-Original-To: bug-gnu-emacs@gnu.org
Original-Received: via spool by submit@debbugs.gnu.org id=B.151377583427331
	(code B ref -1); Wed, 20 Dec 2017 13:18:02 +0000
Original-Received: (at submit) by debbugs.gnu.org; 20 Dec 2017 13:17:14 +0000
Original-Received: from localhost ([127.0.0.1]:43274 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
	id 1eReFG-00076l-GP
	for submit@debbugs.gnu.org; Wed, 20 Dec 2017 08:17:14 -0500
Original-Received: from eggs.gnu.org ([208.118.235.92]:60933)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <geb-bug-gnu-emacs@m.gmane.org>) id 1eReFF-00076Z-6p
	for submit@debbugs.gnu.org; Wed, 20 Dec 2017 08:17:13 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@m.gmane.org>) id 1eReF2-0002IH-Ev
	for submit@debbugs.gnu.org; Wed, 20 Dec 2017 08:17:04 -0500
Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:40418)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
	(Exim 4.71) (envelope-from <geb-bug-gnu-emacs@m.gmane.org>)
	id 1eReF2-0002I2-Bd
	for submit@debbugs.gnu.org; Wed, 20 Dec 2017 08:17:00 -0500
Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51661)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@m.gmane.org>) id 1eReEv-0002JV-RS
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:17:00 -0500
Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <geb-bug-gnu-emacs@m.gmane.org>) id 1eReEq-0001yc-K4
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:16:52 -0500
Original-Received: from [195.159.176.226] (port=52370 helo=blaine.gmane.org)
	by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16)
	(Exim 4.71) (envelope-from <geb-bug-gnu-emacs@m.gmane.org>)
	id 1eReEq-0001xN-CL
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 08:16:48 -0500
Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2)
	(envelope-from <geb-bug-gnu-emacs@m.gmane.org>) id 1eReCl-0006o3-5x
	for bug-gnu-emacs@gnu.org; Wed, 20 Dec 2017 14:14:39 +0100
X-Injected-Via-Gmane: http://gmane.org/
Original-Lines: 95
Original-X-Complaints-To: usenet@blaine.gmane.org
Cancel-Lock: sha1:Foq0s3MMaN2hzItFlHHN/l319IY=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
	[fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 208.118.235.43
X-BeenThere: bug-gnu-emacs@gnu.org
List-Id: "Bug reports for GNU Emacs,
	the Swiss army knife of text editors" <bug-gnu-emacs.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/bug-gnu-emacs/>
List-Post: <mailto:bug-gnu-emacs@gnu.org>
List-Help: <mailto:bug-gnu-emacs-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/bug-gnu-emacs>,
	<mailto:bug-gnu-emacs-request@gnu.org?subject=subscribe>
Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org
Original-Sender: "bug-gnu-emacs"
	<bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org>
Xref: news.gmane.org gmane.emacs.bugs:141293
Archived-At: <http://permalink.gmane.org/gmane.emacs.bugs/141293>

On Wed 20 Dec 2017, Andy Moreton wrote:

> On Tue 19 Dec 2017, Ted Zlatanov wrote:
>
>> On Tue, 19 Dec 2017 22:00:34 +0000 Kaushal Modi <kaushal.modi@gmail.com> wrote: 
>>
>> KM> I couldn't test the fix on my local machine because I cannot recreate the
>> KM> problem there.
>>
>> KM> So I was waiting for the emacs-26 branch build to finish on the Travis CI
>> KM> set up by Noam.. but the build itself failed:
>> KM> https://travis-ci.org/npostavs/emacs-travis/jobs/318857869
>>
>> KM>   CC       lastfile.o
>> KM>   CCLD     temacs
>> KM> gnutls.o: In function `Fgnutls_available_p':
>> KM> gnutls.c:(.text+0x105d): undefined reference to `gnutls_ext_get_name'
>> KM> collect2: error: ld returned 1 exit status
>> KM> make[1]: *** [temacs] Error 1
>> KM> make[1]: Leaving directory `/tmp/emacs-emacs-26/src'
>> KM> make: *** [src] Error 2
>> KM> make: Leaving directory `/tmp/emacs-emacs-26'
>>
>> I don't understand why. This function has been available since GnuTLS
>> was created, according to the docs. Do we know what GnuTLS version is used
>> in Travis CI?
>
> The Windows builds of emacs use runtime imports of GnuTLS functions, so
> that emacs will still run on a system that does not have the required
> DLLs installed.

Please ignore the previous patch - this version has been tested:

diff --git a/src/gnutls.c b/src/gnutls.c
index 8db201ae83..acea77ba32 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -238,6 +238,7 @@ DEF_DLL_FN (int, gnutls_hash, (gnutls_hash_hd_t, const void *, size_t));
 DEF_DLL_FN (void, gnutls_hash_deinit, (gnutls_hash_hd_t, void *));
 DEF_DLL_FN (void, gnutls_hash_output, (gnutls_hash_hd_t, void *));
 #  endif	 /* HAVE_GNUTLS3 */
+DEF_DLL_FN (const char *, gnutls_ext_get_name, (unsigned int));
 
 
 static bool
@@ -357,6 +358,7 @@ init_gnutls_functions (void)
   LOAD_DLL_FN (library, gnutls_hash_deinit);
   LOAD_DLL_FN (library, gnutls_hash_output);
 #  endif	 /* HAVE_GNUTLS3 */
+  LOAD_DLL_FN (library, gnutls_ext_get_name);
 
   max_log_level = global_gnutls_log_level;
 
@@ -470,6 +472,8 @@ init_gnutls_functions (void)
 #  define gnutls_hash_deinit fn_gnutls_hash_deinit
 #  define gnutls_hash_output fn_gnutls_hash_output
 #  endif	 /* HAVE_GNUTLS3 */
+#  define gnutls_ext_get_name fn_gnutls_ext_get_name
+
 
 /* This wrapper is called from fns.c, which doesn't know about the
    LOAD_DLL_FN stuff above.  */
@@ -2439,15 +2443,6 @@ Any GnuTLS extension with ID up to 100
   capabilities = Fcons (intern("macs"), capabilities);
 # endif	  /* HAVE_GNUTLS3 */
 
-  for (unsigned int ext=0; ext < 100; ext++)
-    {
-      const char* name = gnutls_ext_get_name(ext);
-      if (name != NULL)
-        {
-          capabilities = Fcons (intern(name), capabilities);
-        }
-    }
-
 # ifdef WINDOWSNT
   Lisp_Object found = Fassq (Qgnutls, Vlibrary_cache);
   if (CONSP (found))
@@ -2462,6 +2457,15 @@ Any GnuTLS extension with ID up to 100
 # endif /* WINDOWSNT */
 #endif	/* HAVE_GNUTLS */
 
+  for (unsigned int ext=0; ext < 100; ext++)
+    {
+      const char* name = gnutls_ext_get_name(ext);
+      if (name != NULL)
+        {
+          capabilities = Fcons (intern(name), capabilities);
+        }
+    }
+
   return capabilities;
 }