From patchwork Mon Oct 9 15:02:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Storm, Christian" X-Patchwork-Id: 823288 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:400c:c09::23b; helo=mail-wm0-x23b.google.com; envelope-from=swupdate+bncbdd6bwv65qpbbie753hakgqe73eei6y@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="FVUcoG+k"; dkim-atps=neutral Received: from mail-wm0-x23b.google.com (mail-wm0-x23b.google.com [IPv6:2a00:1450:400c:c09::23b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3y9k4z6TnYz9rxm for ; Tue, 10 Oct 2017 02:02:59 +1100 (AEDT) Received: by mail-wm0-x23b.google.com with SMTP id r202sf3240538wmd.17 for ; Mon, 09 Oct 2017 08:02:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1507561376; cv=pass; d=google.com; s=arc-20160816; b=raPZeE7DUyaG0T8+eHllDM2m+wPgEIihtHZTxGDzLTFbM5gXhsc3EKJLW/aydx46ee srvkp1fooFecpfLpJYMogpmITxxvBGIpl424zEBjzGgtRr3AaIeV6QnTnYstSYV+A9ZT 9EyoYkdkKr1k71HzzUsp6iuF8rJ4KhaTfsIvJfewyJ4MXFJh38wdXOE3FBC6qdbPSFVo Ma0S8vbwHZBb7dbIZIZLP0oCW/2/tQ5Ve7DAfK2ZtaGjtNS0P2wyr42Y93tRqkPfVf97 NrcjQp5VqtoA+ZfAZHL5zHGLu4iRSm6Lp6fJrUxrH9FoSWz2T6msamiCDnOkwN+zey0+ pF3A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:user-agent :content-transfer-encoding:content-disposition:mime-version :mail-followup-to:message-id:subject:to:from:date :arc-authentication-results:arc-message-signature:sender :dkim-signature:arc-authentication-results; bh=lTjryaDDQy6crMv3grABhP9nUi6dshquyLqOot8NFgQ=; b=hEL4AXR3D4xefFGyOKIzaxxBHVXBZF9fVKyBDLdNKmd4+sk7E3iMehsS/Pm9vINck7 jAjRiBD5/GxqMYzl8w19P9WuszWRzQLhNMNmSf1JgjwE2KFoe4AYmDQM1djA/TsjqsgJ PxaULFdmmis9EBVw24tRMjAJvelXmKo3K8acGx7gI9iE5eVo3GMiQF/gZS2Axkp2CWky lfsoqF5fHDGj1V6wtjmPgeSKXqNKHncBmR97GKaCSIYEHed8L+EaBTixM4YjEEpEGrjx yxwF2fGC7Txpua+mS51W+CRo4Pl12nYhDC/QFQ+s4f7qvXyN68bAe2190kvgDLHcWoAK 86nA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 is neither permitted nor denied by domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:date:from:to:subject:message-id:mail-followup-to :mime-version:content-disposition:content-transfer-encoding :user-agent:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=lTjryaDDQy6crMv3grABhP9nUi6dshquyLqOot8NFgQ=; b=FVUcoG+kDd1vxFNc8T2vk+I9UMUzRjiBQPY71axWEiK00+iAwyLHw4gJ+9+PPGZT2n siBN/rs1iDhlOPVhrdgUAuajKjCyotu3k93/tGKDuMmySW+KmCO71hkQ8hKacBvW6HAU PdRWWL4O4quJ8EeDv+2RRywG3aAjOGg9uc4Hl7Mxp8ETo0sYjsGsHnWlzQIMT0qkC9AF 8VO3kSZV3RC6cBv58XwUBZkOkGxNdGFKGdx9N3sXsutcJtEbbHDvKqS99BUef79Rt/wf /7BxZCe0gqC3ibCtegsqHP54OzliBaJSc0t+aYF9tNFdbAQqY2wA8hV7dYrybNKo+Pwl yP+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:date:from:to:subject:message-id :mail-followup-to:mime-version:content-disposition :content-transfer-encoding:user-agent:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=lTjryaDDQy6crMv3grABhP9nUi6dshquyLqOot8NFgQ=; b=dnmxS7gpJLdsYn6tlpa//LKz8VYfmgPu8+O9yNVlIABzxTYMM3xVtfNLYXHK4lD6RL UFzsy5q/r5EKaLjXOKtud/WxsbIg/po5nJhUZ7LyS1L/neUeCk4Xp5KeQFdAcNO7hHFT sbHmseIXcCgMaonPjNz8MpOCQOjTbf+b0GIvv47Gvvz1qHRvPOk/D+Ri6fE4x9j1fmAq y6f27AhH0956yYf85ABzMvgTINN4ebs0Py6HLIrOf2z0M8cvnASpB21kuYj3PBwMy2BQ CfDwG5ezQAhkEiK8C2wtjDLqlQD+EoSx3nxdxnSlZzS827PvAxqXPFEJustWfl2r7FTL YQyQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AMCzsaWMVwR5kapz+dyrhccO4+BunL4XcuR5QjNrGSoz+OW58HjT9JEh +o6Qm3y/jb6wZtBDy6wytRI= X-Google-Smtp-Source: AOwi7QAoIUaz1gP9iJDv+j8759OeR9yjz6N+vPOKfN3KouWbeaAzfEQd7LjcWoGKaZxiAc0cGbvuMw== X-Received: by 10.28.14.200 with SMTP id 191mr27579wmo.5.1507561376640; Mon, 09 Oct 2017 08:02:56 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 10.28.197.15 with SMTP id v15ls219219wmf.2.canary-gmail; Mon, 09 Oct 2017 08:02:56 -0700 (PDT) X-Received: by 10.28.147.133 with SMTP id v127mr1083665wmd.18.1507561376291; Mon, 09 Oct 2017 08:02:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507561376; cv=none; d=google.com; s=arc-20160816; b=IyNu83vNJobDwLS/WTTIbC2IoPp6h1GysYzbK9gIK8X3pAdjGbo+0E2pJYmNwUfwNM B8Pf9z9jiuNudoq4uWCjm/GLcjjCzvdxSFa78TXyByoXTtAqo3zRyFm++hgmMTP9lMFe haIYq9YWhZoMEkfDB/P4njINL7G72FyZUPm9cTXdK6rC7cYsf6qHrJJEKMQw1LtdQZrC oHmVwSOvPSnuBQ6xWAiBB31guLWy0m1yQ21K+MXyNsnc4DHkj0M7fMB1Q0A2ebSZEI6Y HbcMZjY2cMYOmhPOO6EKhCdAmB+IpRX2wtuMPab6NEyl+NZRMMJXrYqVqXgQ8z+YIyc1 oJ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:content-transfer-encoding:content-disposition :mime-version:mail-followup-to:message-id:subject:to:from:date :arc-authentication-results; bh=FWRd/vBuk+lkIPGLFjbn48It5IUEOPM51H2xqi7FKX8=; b=pDy42Ci2Gs36MbvKLeAmgrFLLR+rR/Kqwlebu+2ZzTyx8NuM/P5oOxyme+CoRkNwCS 9X1WbkNncEiQqKVAK8AFzpgWjqozBm3KQVttwwjCwWou4LFV9GSjtjeRSgtuN274Dnvu AahYodM2vGm4Q7aDTwJKm0Tbd5WdKzRBEfALJViMuq5bhdB6S+TW+mcar/P+fvXlW8Ja qryP7prZL6e/hWZPix39HHYHzkibPpJ6DMRpK/T+3vAE0qvvLGRcLmdHv/AnkCTyvkFY M+x4O9u5n6DGWLb0y58NMRPT3BU4tP1/uab8CrbVOHbn7tdB1QYpx4z0aMwYBH6bZmUW 7pww== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 is neither permitted nor denied by domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id b123si875468wme.3.2017.10.09.08.02.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2017 08:02:56 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.2 is neither permitted nor denied by domain of christian.storm@siemens.com) client-ip=192.35.17.2; Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id v99F2t6I016035 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK) for ; Mon, 9 Oct 2017 17:02:55 +0200 Received: from localhost ([139.25.69.251]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTPS id v99F2tCu013295 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Mon, 9 Oct 2017 17:02:55 +0200 Date: Mon, 9 Oct 2017 17:02:41 +0200 From: Christian Storm To: swupdate@googlegroups.com Subject: [swupdate] State of Lua version(s) supported/working Message-ID: <20171009150241.7fcrcm3kp3n7s3u5@MD1KR9XC.ww002.siemens.net> Mail-Followup-To: swupdate@googlegroups.com MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/20170113 (1.7.2) X-Original-Sender: christian.storm@siemens.com X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.2 is neither permitted nor denied by domain of christian.storm@siemens.com) smtp.mailfrom=christian.storm@siemens.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , Hi, I did a quick compile test with various versions of Lua: * Lua 5.3: works. * Lua 5.2: works. * Lua 5.1: does not work, with the following errors: corelib/lua_interface.c:421:2: warning: implicit declaration of function ‘luaL_newlib’ corelib/lua_interface.c:485:6: error: ‘LUA_OK’ undeclared corelib/lua_interface.c:538:3: warning: implicit declaration of function ‘luaL_requiref’ These are all available from Lua 5.2 onwards. As Lua 5.1 was released on 21st Feb 2006 and 5.2 on 16th Dec 2011, I guess Lua 5.2 does qualify as minimal Lua version requirement? Travis also uses the 5.2 version by the way. Otherwise, we either need to get rid of the 5.2ish functions or implement some mapping code like the following patch (copied and assembled from https://github.com/keplerproject/lua-compat-5.2): Kind regards, Christian diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index 14f9251..c716982 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -29,6 +29,45 @@ #include "util.h" #include "handler.h" +/* from https://github.com/keplerproject/lua-compat-5.2 */ +#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM == 501 +void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup); +void luaL_requiref(lua_State *L, char const* modname, lua_CFunction openf, int glb); + +void luaL_setfuncs(lua_State *L, const luaL_Reg *l, int nup) { + luaL_checkstack(L, nup+1, "too many upvalues"); + for (; l->name != NULL; l++) { /* fill the table with given functions */ + int i; + lua_pushstring(L, l->name); + for (i = 0; i < nup; i++) /* copy upvalues to the top */ + lua_pushvalue(L, -(nup + 1)); + lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ + lua_settable(L, -(nup + 3)); /* table must be below the upvalues, the name and the closure */ + } + lua_pop(L, nup); /* remove upvalues */ +} + +void luaL_requiref(lua_State *L, char const* modname, lua_CFunction openf, int glb) { + luaL_checkstack(L, 3, "not enough stack slots"); + lua_pushcfunction(L, openf); + lua_pushstring(L, modname); + lua_call(L, 1, 1); + lua_getglobal(L, "package"); + lua_getfield(L, -1, "loaded"); + lua_replace(L, -2); + lua_pushvalue(L, -2); + lua_setfield(L, -2, modname); + lua_pop(L, 1); + if (glb) { + lua_pushvalue(L, -1); + lua_setglobal(L, modname); + } +} + +#define LUA_OK 0 +#define luaL_newlib(L, l) (lua_newtable((L)),luaL_setfuncs((L), (l), 0)) +#endif + #define LUA_PUSH_IMG_STRING(img, attr, field) do { \ lua_pushstring(L, attr); \ lua_pushstring(L, img->field); \