From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] GnuTLS support on Woe32 Date: Mon, 02 May 2011 13:29:35 -0500 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87hb9dufao.fsf@lifelogs.com> References: <87ipvwl1nx.wl%claudio.bley@gmail.com> <87wrjquacf.fsf@lifelogs.com> <87lj05svwh.fsf@lifelogs.com> <87bp11imgb.wl%claudio.bley@gmail.com> <8739mc5nes.fsf@lifelogs.com> <87ipuubao6.fsf@lifelogs.com> <87fwpjfkkz.fsf@lifelogs.com> <87bp072fb1.fsf@lifelogs.com> <874o5vimm5.fsf@lifelogs.com> <87zknjmcyk.fsf@lifelogs.com> <87sjta2zvp.fsf@lifelogs.com> <87liyzglkh.fsf@lifelogs.com> <4DB77682.1070605@gmail.com> <8762q04ba1.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1304361002 7743 80.91.229.12 (2 May 2011 18:30:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 May 2011 18:30:02 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon May 02 20:29:59 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QGxsc-00058I-8U for ged-emacs-devel@m.gmane.org; Mon, 02 May 2011 20:29:58 +0200 Original-Received: from localhost ([::1]:47421 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGxsb-0007zE-Jv for ged-emacs-devel@m.gmane.org; Mon, 02 May 2011 14:29:57 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:51343) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGxsY-0007yy-Aw for emacs-devel@gnu.org; Mon, 02 May 2011 14:29:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGxsX-0004Nh-IG for emacs-devel@gnu.org; Mon, 02 May 2011 14:29:54 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:38201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGxsX-0004Nd-6r for emacs-devel@gnu.org; Mon, 02 May 2011 14:29:53 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QGxsV-00054w-1y for emacs-devel@gnu.org; Mon, 02 May 2011 20:29:51 +0200 Original-Received: from 38.98.147.130 ([38.98.147.130]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 May 2011 20:29:51 +0200 Original-Received: from tzz by 38.98.147.130 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 02 May 2011 20:29:51 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 65 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 38.98.147.130 X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:TyTGVARHwNVqrel3gj5x3F/bbVs= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138975 Archived-At: On Mon, 2 May 2011 18:20:56 +0200 Juanma Barranquero wrote: JB> On Wed, Apr 27, 2011 at 14:19, Juanma Barranquero wrote: >> GnuTLS was one of the reasons that prompted me to change >> `image-library-alist' to `dynamic-library-alist', so yes, I plan to do >> it if nobody beats me to it. >> >> But I won't be able to spend time on that in at least a week or two, >> perhaps more, so there's ample time for someone to step in... JB> I'm working on this. JB> First question: what should the code do when the gnutls library cannot JB> be loaded at runtime? I mean, which is the single point that can JB> return a failure exit code, let's say, GNUTLS_EMACS_ERROR_NOT_LOADED JB> (== GNUTLS_E_APPLICATION_ERROR_MIN + 1), so the rest of the GnuTLS JB> code is disabled? JB> I'm thinking there will be a function init_gnutls_functions (), called JB> from syms_of_gnutls or Fgnutls_boot, which in addition to adjusting JB> the function pointers, sets a success/failure flag. And then, from the JB> elisp side, either that variable of a function gnutls-is-loaded-p JB> which the gnutls.el functions will have to consult. All the C GnuTLS init code (currently `gnutls-boot') calls `emacs_gnutls_global_init' *every time*, which is short enough to quote here: #+begin_src c static Lisp_Object emacs_gnutls_global_init (void) { int ret = GNUTLS_E_SUCCESS; if (!gnutls_global_initialized) ret = gnutls_global_init (); gnutls_global_initialized = 1; return gnutls_make_error (ret); } #+end_src ... and then in `gnutls-boot': #+begin_src c /* always initialize globals. */ global_init = emacs_gnutls_global_init (); if (! NILP (Fgnutls_errorp (global_init))) return global_init; #+end_src So we just need to modify `emacs_gnutls_global_init' to load and check the GnuTLS library and return an appropriate error (which can be any ELisp number object, so you can attach debug info to it). Or you can do it once at init time, which seems less convenient to the user but less work. I don't have an opinion either way. JB> Does that sound right? If so, can you take care of the gnutls.el side of things? I think gnutls.el should not know about this. It should simply get an error from the C layer if the library could not be loaded. Ted