From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.devel Subject: Re: Dynamic loading progress Date: Fri, 20 Nov 2015 22:36:56 +0000 Message-ID: References: <87io5bv1it.fsf@lifelogs.com> <87egfzuwca.fsf@lifelogs.com> <876118u6f2.fsf@lifelogs.com> <8737w3qero.fsf@lifelogs.com> <831tbn9g9j.fsf@gnu.org> <878u5upw7o.fsf@lifelogs.com> <83ziya8xph.fsf@gnu.org> <83y4du80xo.fsf@gnu.org> <564E6081.9010805@cs.ucla.edu> <564E6352.20701@cs.ucla.edu> <564F86FF.6030202@cs.ucla.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e0102def4da90850525008369 X-Trace: ger.gmane.org 1448059037 25556 80.91.229.3 (20 Nov 2015 22:37:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 20 Nov 2015 22:37:17 +0000 (UTC) Cc: emacs-devel@gnu.org To: Paul Eggert , Eli Zaretskii , Ted Zlatanov , =?UTF-8?Q?Aur=C3=A9lien_Aptel?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 20 23:37:16 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZzuIs-0008BU-Lq for ged-emacs-devel@m.gmane.org; Fri, 20 Nov 2015 23:37:14 +0100 Original-Received: from localhost ([::1]:50169 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzuIr-0006Ir-Pq for ged-emacs-devel@m.gmane.org; Fri, 20 Nov 2015 17:37:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzuIo-0006Il-0Z for emacs-devel@gnu.org; Fri, 20 Nov 2015 17:37:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzuIm-0003zv-R9 for emacs-devel@gnu.org; Fri, 20 Nov 2015 17:37:09 -0500 Original-Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:32950) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzuIk-0003zc-Og; Fri, 20 Nov 2015 17:37:06 -0500 Original-Received: by wmec201 with SMTP id c201so91241950wme.0; Fri, 20 Nov 2015 14:37:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-type; bh=P9kFIgO2zJIji7Ceg94yncVjuOilOcTOs0wvT6DtANQ=; b=rI6xA03tZt8JbxNkHtiopmPapTc/9IEb4NtFFfBs5U66vxlzt7Y8hjpvp6PrIFYZ1d QtHgYx/HPDjziZyKNo11U+wtQldEe+BvgwEEwYVXGgZnVscBRSU9hY1PWBcYslRcKnbN 211S8tvi8d3Rbi0Jp9vkJqiuCh5XnHldl/2wfrNJeawHKcLhH+RX34MDCneH75U1xGmx Nf9adtgRXuR4DIfRKCrvkSB5EubnCtOdD6bwg61XHkW3C9QB+/8+S+G9FrOScuYKdojV XZ1FFLEepFZyptD1LJaCGymdkNmI2BY8kwERjCy8S4jMpovl4hRbSIhdD03zNIsAE+pA d9kA== X-Received: by 10.194.87.39 with SMTP id u7mr17149712wjz.11.1448059025917; Fri, 20 Nov 2015 14:37:05 -0800 (PST) In-Reply-To: <564F86FF.6030202@cs.ucla.edu> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c09::22e 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:194906 Archived-At: --089e0102def4da90850525008369 Content-Type: text/plain; charset=UTF-8 Paul Eggert schrieb am Fr., 20. Nov. 2015 um 21:48 Uhr: > Philipp Stephani wrote: > > This member will typically be used as follows: > > > > if (env->size >= sizeof *env) { > > // good, object is at least as big as expected > > } else { > > // Emacs is too old > > } > > > I'm leery of recommending this sort of checking. In practice incompatible > structure layout changes so often involve something more than merely > extending a > structure, that a size check is not worth the trouble; No such incompatible changes can be allowed to the emacs_env and emacs_runtime structures. Only additions at the end of the structures are allowed. This is independent of how the version checking is made. > you really want a version > check. I might be persuaded that it's a good idea See Daniel's initial design ( https://lists.gnu.org/archive/html/emacs-devel/2015-02/msg00960.html) for rationale. > if I saw some code doing it > effectively, but currently there is no such code in the Emacs sources Not inside Emacs, but e.g. the Windows API uses this approach extensively for version checking, and has been forward- and backward-compatible for decades with it. > (the > module test function doesn't check sizes -- why not?). > Just an omission, we'll fix that. All modules need to do version checks so they don't run into UB if they use a more recent emacs-module.h than the Emacs in which they are loaded. --089e0102def4da90850525008369 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Paul E= ggert <eggert@cs.ucla.edu> = schrieb am Fr., 20. Nov. 2015 um 21:48=C2=A0Uhr:
Philipp Stephani wrote:
> This member will typically be used as follows:
>
> if (env->size >=3D sizeof *env) {
>=C2=A0 =C2=A0 // good, object is at least as big as expected
> } else {
>=C2=A0 =C2=A0 // Emacs is too old
> }


I'm leery of recommending this sort of checking.=C2=A0 In practice inco= mpatible
structure layout changes so often involve something more than merely extend= ing a
structure, that a size check is not worth the trouble;
No such incompatible changes can be allowed to the emacs_env a= nd emacs_runtime structures. Only additions at the end of the structures ar= e allowed. This is independent of how the version checking is made.
=C2=A0
you really want a version
check.=C2=A0 I might be persuaded that it's a good idea

=
=C2=A0
if I saw some code doing i= t
effectively, but currently there is no such code in the Emacs sources

Not inside Emacs, but e.g. the Windows API uses = this approach extensively for version checking, and has been forward- and b= ackward-compatible for decades with it.
=C2=A0
(the
module test function doesn't check sizes -- why not?).
=

=C2=A0Just an omission, we'll fix that. All modules= need to do version checks so they don't run into UB if they use a more= recent emacs-module.h than the Emacs in which they are loaded.
= --089e0102def4da90850525008369--