From patchwork Mon Dec 14 14:20:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ed W X-Patchwork-Id: 1415973 X-Patchwork-Delegate: ynezz@true.cz Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=wildgooses.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=dMSZz9Qq; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=wildgooses.com header.i=@wildgooses.com header.a=rsa-sha256 header.s=dkim header.b=WombbdvT; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CvkCm4jn1z9sT6 for ; Tue, 15 Dec 2020 01:24:04 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:Date:Message-ID:Subject:From:To:Reply-To:Cc:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Owner; bh=XT8lJnkik9mELNHOiLvl9IlMASKGvI/RsXYnJ4fepQE=; b=dMSZz9QqDgroq6MZjayZEokmbD SZJKbBoXbg2HsWV38R4GKQx2aa/nT4bp0yGE92lklMy+EuNwbY0DpTdDqqsRJS8WaJYyb5PfmotxK zgEfBJpOEXy9+03Ln/4odffB8a/kg1ynRPw8AVcn7SCZx4/er9Ynp4BmdEF3m4TJOzd2uvfbZS65g 5pIJnnMIJS6ETgwvV5xhOvwwO1dD4LvoxNM27RoDeV/sXpCSGXeEHX8eBkdSgjMQS53D2nw2sKtXC W+SYOJS66poCwzz9rDtVHRGjmw+NpORHTA0GYHYVbMPh1CaYV3/s8+acF/AWBA4JT2mBBqt2bFy6H w+bQRgnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kooil-0001ox-Sx; Mon, 14 Dec 2020 14:21:03 +0000 Received: from mail1.nippynetworks.com ([91.220.24.129]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kooij-0001o0-6j for openwrt-devel@lists.openwrt.org; Mon, 14 Dec 2020 14:21:02 +0000 Received: from macbookpro-ed.wildgooses.lan (unknown [212.69.38.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature ECDSA (P-256)) (No client certificate requested) (Authenticated sender: ed@wildgooses.com) by mail1.nippynetworks.com (Postfix) with ESMTPSA id 4Cvk890F5rzTgWt for ; Mon, 14 Dec 2020 14:20:56 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wildgooses.com; s=dkim; t=1607955657; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IZgtThqmxZZ3IdQIuob9bFDTZuxJv0vB4KooQvvfiYM=; b=WombbdvTpI0XVSLwS2NyWN++of6div3R4IkG3h98zIjk/vrGLBMyh59A2F/c9waJlG9QSs IcNkAFGd4OdqTEHHVzTJrCVfYko0IezU4dP5NdWxh0TN3L3APGkTvGGayqk3kSnz9vbiK8 p6dszn4T8IgvTwM06dxBfc3lppPKOLc= To: openwrt-devel@lists.openwrt.org From: Ed W Subject: Patch: update libubox to compile against lua-5.3 Message-ID: <9097dafc-1bb0-bf4e-818f-76299d1ccb20@wildgooses.com> Date: Mon, 14 Dec 2020 14:20:56 +0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201214_092101_420147_46A1AEB2 X-CRM114-Status: GOOD ( 12.33 ) X-Spam-Score: -0.9 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [91.220.24.129 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Hi, I was interested to use uqmi in another project using gentoo, so I needed to create an ebuild package. I'm using lua-5.3, so I hit some compile errors with libubox Now, I sense that you are unlikely to upgrade your lua anytime soon, but these changes seem pretty trivial and I think with a wrapper for "luaL_setfuncs" which does something like the following you should be able to support all versions of lua 5.1-5.4? #if LUA_VERSION_NUM < 502 #  define luaL_setfuncs(L,l,nup) luaI_openlib(L,NULL,l,nup) #endif I'm not really a lua guy though... Just know enough to shoot foot off.. Could someone please take a look at this and perhaps smooth it off to ensure it works with your existing lua5.1 as well? Signed-off-by: Ed Wildgoose --- a/lua/uloop.c    2020-12-14 14:00:27.826908981 +0000 +++ b/lua/uloop.c    2020-12-14 14:00:43.478066405 +0000 @@ -57,7 +57,7 @@      lua_pushvalue(L, -1);      lua_setmetatable(L, -3);      lua_pushvalue(L, -2); -    luaI_openlib(L, NULL, reg, 1); +    luaL_setfuncs(L, reg, 1);      lua_pushvalue(L, -2);      return ret; @@ -341,8 +341,8 @@      if (pid == 0) {          /* child */ -        int argn = lua_objlen(L, -3); -        int envn = lua_objlen(L, -2); +        int argn = lua_rawlen(L, -3); +        int envn = lua_rawlen(L, -2);          char** argp = malloc(sizeof(char*) * (argn + 2));          char** envp = malloc(sizeof(char*) * (envn + 1));          int i = 1; @@ -404,7 +404,7 @@      return 1;  } -static luaL_reg uloop_func[] = { +static luaL_Reg uloop_func[] = {      {"init", ul_init},      {"run", ul_run},      {"timer", ul_timer}, @@ -428,7 +428,11 @@      lua_createtable(L, 1, 0);      lua_setglobal(L, "__uloop_fds"); -    luaL_openlib(L, "uloop", uloop_func, 0); +    //luaL_openlib(L, "uloop", uloop_func, 0); +    lua_newtable(L); +    luaL_setfuncs(L, uloop_func, 0); +    lua_setglobal(L, "uloop"); +      lua_pushstring(L, "_VERSION");      lua_pushstring(L, "1.0");      lua_rawset(L, -3);