Message ID | 1515509643-24947-1-git-send-email-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBFFP2PJAKGQEQ5XI23I@googlegroups.com> 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:4010:c07::23d; helo=mail-lf0-x23d.google.com; envelope-from=swupdate+bncbcxploxj6ikrbffp2pjakgqeq5xi23i@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.b="s96a3mz6"; dkim-atps=neutral Received: from mail-lf0-x23d.google.com (mail-lf0-x23d.google.com [IPv6:2a00:1450:4010:c07::23d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zGFXV3B3lz9s7s for <incoming@patchwork.ozlabs.org>; Wed, 10 Jan 2018 01:54:16 +1100 (AEDT) Received: by mail-lf0-x23d.google.com with SMTP id y8sf3625435lfj.1 for <incoming@patchwork.ozlabs.org>; Tue, 09 Jan 2018 06:54:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1515509653; cv=pass; d=google.com; s=arc-20160816; b=fciVvulLzq7/nL+wOm2+Q1NRgunmOE/gOIjhv9XZzJT5h2HCgbaW8iROg2C09E//gV /c/ONjplyDIwu3LrTcaATIQef8At/SWs035WAN2BdCXHnrR8KHQN20Hoci+1J2lkdJ1c AtYQRUVFh0oNRXzYz79aguRRxVMCK0eSfRn/JVPWVgYhpBHqrtZZDk6Xro5uP+fUoN/O KtUJMFcVc/QuHI7ux/d5ZBjdk+K++DvRm7EnoBgLUzVZvfUs6EqtavDNSEMN5xoWgN+b zKjkLFm6B5wSKVUkFgdZosAVj1uUW67nOM8b1GiJJVU6RCokVvgBSJmbF6knH0pEcabV yjAA== 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:message-id:date:subject:cc:to:from :arc-authentication-results:arc-message-signature:mime-version :sender:dkim-signature:arc-authentication-results; bh=R48RN7fzJCi/WoNgkWwQKuHcbP4qSRp4MmDI7KC3qkw=; b=yJFH0lj5WbmzSxEy0Be6Dy204yXbbmPiM1GW0UjFle1kkb4DmGmBJSn3kxtLxe8waY B+miPA5R4QAi9JkHMtohbiG+mXP6D2qIK8a/SMt0xdiBoEW6nRdmAX98769IJts01YMl xiUVFlQvsP6rZqQYqCmUlUX1i83t5TjUU3TbwCWMJKRmyPmMMaPLjnQBQZ6SBPmwrkKR PEp5CpNSyQ3VRTjC7wsjY/3sQz2f67XnVAMCOl0gRVe2F0AT1qfgIamcrM+wGPq7mTMk byVv4vzG/MsHQOYd5Ls1toH5w8XKnAI0uYCEUJT9XOw4lqsbjcCmwOjBTeCT4prWy10e Opgg== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:mime-version:from:to:cc:subject:date:message-id :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=R48RN7fzJCi/WoNgkWwQKuHcbP4qSRp4MmDI7KC3qkw=; b=s96a3mz6b2EjiKOR2EySxWNl1Poj0qvI+qCb5qC5mPMwukJpZbrPqR3jtyqrF2c3Vy xDxCHITTB9CSExr6WzWeiNF6bf0K9OpzF/pS9qnk8D/ETNEvBIc5oORnrWlap7kwQk65 GSBoSZUDIzYTIBUsKOwIOdFVntPu9//2oT6Sys9wUCbX9lF4STUQR+OcNgxYpFbVtOcv Ne4l+len09rpZvjXA4LdYdbeR1WV9O8OLvx0qKmdKzBeNTIjJAgsuyJoSxfHX3ANzqYb sW3qOnCAa3suukhhxolXmYGRCVpKzEppHlgiQ/UzOgkEkExAoa4NBIOlgGg6yaS9Vkg0 aTcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id: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=R48RN7fzJCi/WoNgkWwQKuHcbP4qSRp4MmDI7KC3qkw=; b=YT9z+7djlg2176tolxD3BCvTt4H1VXaaoKxiTrjlH7YLER1JfDC8QYEq5dpD0Ps0K+ +tuckEDvv1gHJDXaVLCTb9HXlTFidledo7IbeM7XTROiazlqHOE0KVZRS/szqMW5S4Ya LyyketWS2zTLVbdPlEO5Nm0VuUD711KD4eQKMQnZ2yVnLxH/8vS63Wi2RRfgEcRxOciY Gea2Ast/AT33iOrgg6t4C4i6NWn419AeKudqGI0RMXNy+Axkozs8eOdZIZp//6OQt8cD 2MlIXv0Q5feaE9pN4t+Ag32D75NyDe0wpKK2U4YUDTdr0HpruUZD6/AZ920toRKN5QYu cvpQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AKGB3mJRVmFNccHoZjjOuepFuaotJoYiNh/QcpXIvmyu/j+7h1zrI6iQ FhivR0yXV/D5j0sCpsre2eU= X-Google-Smtp-Source: ACJfBouHvmAUrXmgjdYwCbyd+gWjVqBfOhIn6ay9ASaaQuUQI7IfDZeZdaKgNru4Bkx/9IoYar4Y4Q== X-Received: by 10.25.208.198 with SMTP id h189mr34180lfg.2.1515509652844; Tue, 09 Jan 2018 06:54:12 -0800 (PST) MIME-Version: 1.0 X-BeenThere: swupdate@googlegroups.com Received: by 10.46.17.217 with SMTP id 86ls443303ljr.9.gmail; Tue, 09 Jan 2018 06:54:12 -0800 (PST) X-Received: by 10.25.157.204 with SMTP id g195mr130521lfe.39.1515509652255; Tue, 09 Jan 2018 06:54:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515509652; cv=none; d=google.com; s=arc-20160816; b=w0nhwmOSS5nprW2nRET4bF6Nev8L/tVocfJ3DYzfJU9FRElgSccfySQSYjaM2t29GA 7RENSnuu7rtpU/Whl/4reVhVZ8buNxQ2xK8qtU2Y999GUFExH6H+Px+KXMjA+qnsdsbf nEu09v32cabCWVr/1qCr0Mg9rJ/57qSdJuUmfFpI3oUj4XBWty+NdZYu08EscgWX2MvQ SEvijdAcjKP+OkUo4S3QUBTfFbo5P3EvXxcGRHbnIHok3FeTU7RJvEIcFVaWjL+mfxcu +uBjlTJh7eFuklhdo0OVnLHajJNrhKvQT68D26nv9eXHZWLNoOs18VfQD7H3wRLrEiae ym5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:arc-authentication-results; bh=43R0qBtpAZk0gQQ7ZpOwkpeDpMoP9mi91vMKaxGVVVQ=; b=k0bJrq0kiYgKxfUBEdSWeFj7ztHJ+mVl0uTyGV7N/iRaIuCkklB4LfVFc0hqIinIo5 L00V+1Uf4k9/E0PU1cKgOsvLOAnBBX8jC7C3hrMC71nuTMQ+SsNc2655lPDX1K0/1VXk OTkYlzvlT3FfopLOMNHUhLDyi57WIX0cbI866KoovIPB1otw85WZ/be3ofBchWAHgxMN SVh6vaL2BEILZ4olGUJigvB+PsgNvOCrmHyr//7hzENo2QSvUePXMpMtl+P276W48CBI cgF2HRT5ZMisulgvDrqEiFwZTP9DTwI0dageLAbQn+ioyS3lPDfGSppX5+PB4DHeo9fE zgSw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.10]) by gmr-mx.google.com with ESMTPS id k77si1457356lfe.1.2018.01.09.06.54.12 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Jan 2018 06:54:12 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.10; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 3zGFXM4F2hz1r9tZ; Tue, 9 Jan 2018 15:54:11 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 3zGFXM447Xz1qqkL; Tue, 9 Jan 2018 15:54:11 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id 0dY0o4yuMM5Z; Tue, 9 Jan 2018 15:54:10 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Tue, 9 Jan 2018 15:54:10 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 72CCB4540448; Tue, 9 Jan 2018 15:54:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ly98EZ5NCO64; Tue, 9 Jan 2018 15:54:08 +0100 (CET) Received: from papero.fritz.box (papero.fritz.box [192.168.178.132]) by babic.homelinux.org (Postfix) with ESMTP id 1A0214540399; Tue, 9 Jan 2018 15:54:08 +0100 (CET) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH] lua: return value from scripts not evaluated Date: Tue, 9 Jan 2018 15:54:03 +0100 Message-Id: <1515509643-24947-1-git-send-email-sbabic@denx.de> X-Mailer: git-send-email 2.7.4 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.10 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
lua: return value from scripts not evaluated
|
expand
|
diff --git a/corelib/lua_interface.c b/corelib/lua_interface.c index f873aac..abc8352 100644 --- a/corelib/lua_interface.c +++ b/corelib/lua_interface.c @@ -185,11 +185,15 @@ int run_lua_script(const char *script, const char *function, char *parms) return -1; } - if (lua_type(L, 1) == LUA_TBOOLEAN) - ret = lua_toboolean(L, 1) ? 0 : 1; + ret = -1; - if (lua_type(L, 2) == LUA_TSTRING) { - output = lua_tostring(L, 2); + if (lua_type(L, -2) == LUA_TBOOLEAN) { + TRACE("LUA Exit: is boolean %d", lua_toboolean(L, -2)); + ret = lua_toboolean(L, -2) ? 0 : 1; + } + + if (lua_type(L, -1) == LUA_TSTRING) { + output = lua_tostring(L, -1); TRACE("Script output: %s script end", output); }
After recent factorization, the return value from LUA scripts is not evaluated because the order of the results on the LUA stack is wrong. Signed-off-by: Stefano Babic <sbabic@denx.de> --- corelib/lua_interface.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)