From patchwork Sat Dec 7 22:52:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1205553 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="IMSEBEJR"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47VlPJ5jQsz9sPK for ; Sun, 8 Dec 2019 10:03:32 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:Message-Id:Date:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Kp+Pk7X65AxMrieakXqCPHxIGec+n7W3HsteZNWqObM=; b=IMSEBEJRERvb8z CO0InlSwYPz8oVse+wwr8+csdQmgHLo30yFEJpTAHOX7uwtm8JjSjblvrS9N2lxUFBvlG7cmOVaCC LnQsWVdfBH56shrWSxViFtORcHObZXTf7M1OtWJiL/ae+nZ3es49f39jcYrzMrKdMOrnt/2Hle1mB VCS+fNanQ90D/8EsY8bcSMWkWoyv9bNafHkLySkwQkx5YrdcCmhyto5YK+YhpV+r2/haamYhBWXs6 sQbstMP6A2UWsL3Qje69Xw0SzJzJxTirmg+06XWJp8hrNVNZj2xAPvhX+gMDK+nHGSiLyEt5OdT02 8cAVIXBLuozFz90g237w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6p-0003YX-1b; Sat, 07 Dec 2019 23:03:31 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6Q-000379-Ag for openwrt-devel@lists.openwrt.org; Sat, 07 Dec 2019 23:03:09 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 11FFA419F; Sun, 8 Dec 2019 00:03:03 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id b67f2a7e; Sun, 8 Dec 2019 00:02:53 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Sat, 7 Dec 2019 23:52:53 +0100 Message-Id: <20191207225257.14135-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191207_150306_540364_5A07D261 X-CRM114-Status: UNSURE ( 5.32 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH uci 1/5] cli: fix format string clang-10 warning X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= , Rosen Penev Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org From: Rosen Penev Fixes: cli.c:196:19: error: format string is not a string literal [-Werror=format-nonliteral] Signed-off-by: Rosen Penev [split into separate commit] Signed-off-by: Petr Štetiar --- cli.c | 1 + 1 file changed, 1 insertion(+) diff --git a/cli.c b/cli.c index 8970f4f0b8ce..6ba97ea07424 100644 --- a/cli.c +++ b/cli.c @@ -185,6 +185,7 @@ static void cli_perror(void) uci_perror(ctx, appname); } +__attribute__((format(printf, 1, 2))) static void cli_error(const char *fmt, ...) { va_list ap; From patchwork Sat Dec 7 22:52:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1205551 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="HyId05ZG"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47VlNv5Mq0z9sPL for ; Sun, 8 Dec 2019 10:03:11 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B5TPeNC8ZGC61OuULdpaYZsgrkZjfgUQ3FYnhiqGtTU=; b=HyId05ZG+M2CrB umWrIMvJxYGP4w4JkBE4L1wpTYuCPB3xm/Zx1ZiGqZAy3dC+xfat7Y6nRUYkbTtTFCQ7ehKIJy4Bv fwp5BJh4PHUlafTObXCqzJ+GKgpDNnq6CoJja2rbNbZe5Ydk6o4Y3NaE1p5y8WeFPqCVPt7w3komB xQeJqxfqm0sZEESVtyAX+rVv0MzJfai9TxKplbOKAetVAsj5uzL4DV+D9gTsNxtqiXUN3IYdg4h+K CDpmM225fXbT6DZiDnZ+kUIWB54BqVXuxKkNzBc5WULDeK9Kj1GYcrR6zTcB+XH+PEwybyoLAplJj jh49JvrhxP9H8WpCMADA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6T-00038m-Kz; Sat, 07 Dec 2019 23:03:09 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6Q-00037A-Af for openwrt-devel@lists.openwrt.org; Sat, 07 Dec 2019 23:03:07 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 6907241A0; Sun, 8 Dec 2019 00:03:03 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 5bb8e673; Sun, 8 Dec 2019 00:02:53 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Sat, 7 Dec 2019 23:52:54 +0100 Message-Id: <20191207225257.14135-2-ynezz@true.cz> In-Reply-To: <20191207225257.14135-1-ynezz@true.cz> References: <20191207225257.14135-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191207_150306_535681_B1029BCA X-CRM114-Status: UNSURE ( 5.08 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH uci 2/5] lua: add missing forward declaration X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org Fixes following warning reported by clang-10: lua/uci.c:1050:1: error: no previous declaration for ‘luaopen_uci’ [-Werror=missing-declarations] Signed-off-by: Petr Štetiar --- lua/uci.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lua/uci.c b/lua/uci.c index ecfb2998d749..196a25bcf08a 100644 --- a/lua/uci.c +++ b/lua/uci.c @@ -36,6 +36,8 @@ #if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501 +int luaopen_uci(lua_State *L); + /* * ** Adapted from Lua 5.2.0 * */ From patchwork Sat Dec 7 22:52:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1205554 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="egBiogku"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47VlPg021qz9sPW for ; Sun, 8 Dec 2019 10:03:50 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xojc+mdy9VW69XEFGJ3dn3VgCGIPumna9SzStBUvgCk=; b=egBiogkuY0RbnQ jn8WlmIc1MedCZtSHKI58mYIDL9C+G/MWq/YRa/CbAxYtmm02vcld2syASwwJBIQUzAimqJRsaD8D 5YioXgbtItwAedxlPxgDrPfWv4MtSqxMQfB/dVnzATwK095cCJIfcclBV1iaC87P35dNvW23fkUUn TE7JD7Vr6gJDtrPI9GNFqOINjOuVkCwbiwuJSDcXMRhv8g5DCVGqE6oH5vg1kNCHnD34DUDeX0rr/ EIfVDpobMr2UIt7M+15H7gFBxeIO3JoGV4rW1aq++965fIB6P/sZY6PAfHRCT9IdGlM346B00H/NF ZF5W0V4J5M4mP1PLv/eg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj73-0003nH-6L; Sat, 07 Dec 2019 23:03:45 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6Q-00037B-Ag for openwrt-devel@lists.openwrt.org; Sat, 07 Dec 2019 23:03:09 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id B2EDA41A1; Sun, 8 Dec 2019 00:03:03 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id 67ad72fc; Sun, 8 Dec 2019 00:02:53 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Sat, 7 Dec 2019 23:52:55 +0100 Message-Id: <20191207225257.14135-3-ynezz@true.cz> In-Reply-To: <20191207225257.14135-1-ynezz@true.cz> References: <20191207225257.14135-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191207_150306_539098_1AF9A558 X-CRM114-Status: UNSURE ( 7.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH uci 3/5] tests: cram: Lua: add test case for uci_get_errorstr X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In order to extend test coverage and help testing refactoring. Signed-off-by: Petr Štetiar --- tests/cram/config/broken | 1 + tests/cram/lua/basic.lua | 2 ++ tests/cram/test_ucilua.t | 1 + 3 files changed, 4 insertions(+) create mode 100644 tests/cram/config/broken diff --git a/tests/cram/config/broken b/tests/cram/config/broken new file mode 100644 index 000000000000..d2ecc0158e68 --- /dev/null +++ b/tests/cram/config/broken @@ -0,0 +1 @@ +config alias' 'a' diff --git a/tests/cram/lua/basic.lua b/tests/cram/lua/basic.lua index ceb706f6973e..f0052644c00e 100644 --- a/tests/cram/lua/basic.lua +++ b/tests/cram/lua/basic.lua @@ -42,3 +42,5 @@ local t = c:get("network", "lan", "dns") A(#t == 2) A(t[1] == "ns1.king.banik.cz") A(t[2] == "ns2.openwrt.org") + +print(c:get_all("broken")) diff --git a/tests/cram/test_ucilua.t b/tests/cram/test_ucilua.t index 1544e23c1bf4..cfe1f2e0e360 100644 --- a/tests/cram/test_ucilua.t +++ b/tests/cram/test_ucilua.t @@ -56,3 +56,4 @@ run basic Lua tests: proto: dhcp .anonymous: false aliases: c d + nil\tuci: Parse error (EOF with unterminated ') at line 1, byte 18 (esc) From patchwork Sat Dec 7 22:52:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1205555 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Noyn4m1E"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47VlPt2g0Hz9sPK for ; Sun, 8 Dec 2019 10:04:02 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aagMTw9AFhLXHikH9/CGh1ikletGBbZ8iQoN2ULw5+w=; b=Noyn4m1Em4l3OT ZF0tLAFvdoYjS+l/D4PPoKhEBUKmQpRVHDAovKR7D15XR0VADSmqVENajdSJG+3vuhNbQ+xq9iV2/ SlrLhZkHTOF89IoI+bzNIxordmcqpSb7s8wXpnGZragHEGa4gQDW0ntaQE80L1Mel0saNLNiQ7lEC GDozTJTH1KSoSZPsnyt28dTJ8qlkXCH+DfZv0t3OBwq6/DvBQj9eJ+hmryXLFchh3Ww+Q9ZP2I1Ns uQlgkzkVbYc6VBmEagJPsNcaWw8Lyn3En6wkOjldZlACUqcNPvEZ1O4HaTsHuV7iNP4lt6Ho37pZa 0FtI32CaKly9qvtyH/7A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj7G-00042F-OF; Sat, 07 Dec 2019 23:03:58 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6Q-00037C-Ai for openwrt-devel@lists.openwrt.org; Sat, 07 Dec 2019 23:03:09 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id E826041A2; Sun, 8 Dec 2019 00:03:03 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id c146b5d3; Sun, 8 Dec 2019 00:02:54 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Sat, 7 Dec 2019 23:52:56 +0100 Message-Id: <20191207225257.14135-4-ynezz@true.cz> In-Reply-To: <20191207225257.14135-1-ynezz@true.cz> References: <20191207225257.14135-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191207_150306_546929_4E209390 X-CRM114-Status: UNSURE ( 8.86 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH uci 4/5] libuci: refactor uci_get_errorstr X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org * replace strange error_info[0]=0 with complete zeroing of the buffer * make the function body shorter and more clear, decrease indentation levels * fix format string warnings: libuci.c:172:24: error: format string is not a string literal [-Werror,-Wformat-nonliteral] libuci.c:181:19: error: format string is not a string literal [-Werror,-Wformat-nonliteral] Reported-by: Rosen Penev Signed-off-by: Petr Štetiar --- libuci.c | 51 +++++++++++++++++++-------------------------------- 1 file changed, 19 insertions(+), 32 deletions(-) diff --git a/libuci.c b/libuci.c index a9e70e883ee3..140edf2adbb0 100644 --- a/libuci.c +++ b/libuci.c @@ -140,50 +140,37 @@ uci_perror(struct uci_context *ctx, const char *str) void uci_get_errorstr(struct uci_context *ctx, char **dest, const char *prefix) { - static char error_info[128]; + static char error_info[128] = { 0 }; int err; - const char *format = - "%s%s" /* prefix */ - "%s%s" /* function */ - "%s" /* error */ - "%s"; /* details */ - - error_info[0] = 0; - - if (!ctx) - err = UCI_ERR_INVAL; - else - err = ctx->err; + err = ctx ? ctx->err : UCI_ERR_INVAL; if ((err < 0) || (err >= UCI_ERR_LAST)) err = UCI_ERR_UNKNOWN; - switch (err) { - case UCI_ERR_PARSE: - if (ctx->pctx) { - snprintf(error_info, sizeof(error_info) - 1, " (%s) at line %d, byte %d", (ctx->pctx->reason ? ctx->pctx->reason : "unknown"), ctx->pctx->line, ctx->pctx->byte); - break; - } - break; - default: - break; + if (ctx && ctx->pctx && (err == UCI_ERR_PARSE)) { + snprintf(error_info, sizeof(error_info) - 1, " (%s) at line %d, byte %d", + (ctx->pctx->reason ? ctx->pctx->reason : "unknown"), + ctx->pctx->line, ctx->pctx->byte); } - if (dest) { - err = asprintf(dest, format, - (prefix ? prefix : ""), (prefix ? ": " : ""), - (ctx && ctx->func ? ctx->func : ""), (ctx && ctx->func ? ": " : ""), - uci_errstr[err], - error_info); - if (err < 0) - *dest = NULL; - } else { + + if (!dest) { strcat(error_info, "\n"); - fprintf(stderr, format, + fprintf(stderr, "%s%s%s%s%s%s", (prefix ? prefix : ""), (prefix ? ": " : ""), (ctx && ctx->func ? ctx->func : ""), (ctx && ctx->func ? ": " : ""), uci_errstr[err], error_info); + return; } + + err = asprintf(dest, "%s%s%s%s%s%s", + (prefix ? prefix : ""), (prefix ? ": " : ""), + (ctx && ctx->func ? ctx->func : ""), (ctx && ctx->func ? ": " : ""), + uci_errstr[err], + error_info); + + if (err < 0) + *dest = NULL; } int uci_list_configs(struct uci_context *ctx, char ***list) From patchwork Sat Dec 7 22:52:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Petr_=C5=A0tetiar?= X-Patchwork-Id: 1205552 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=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=true.cz Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PQtMkwge"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (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 47VlPF6kbTz9sPK for ; Sun, 8 Dec 2019 10:03:29 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Subject:MIME-Version:References: In-Reply-To:Message-Id:Date:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uP+1A40gmiU8veb/TeE4qx5Cox4RIe4bBFCMZ4FbFqg=; b=PQtMkwge90jElk 36SqTqN4QAYs0cHvFDzvSPOIe67J9r80EHEjp3zdw00/RZKniYALcpI1PxtrJlhXTxYijlpb8TU/T BPB0ouFIGOCAlBF+Su+4p1+Y6EnJxv9sZNVDl2OJw1+Hs/1d7BEEaZ5KIcjQ53XgUPH/Wjiwl2qmf lVmTq16WD7lv9afr5IEGzTz9q/ofl3sxkBi288gjNMVz3sM6NyUVWup9R4jXP5OvSzWa5OUAcIzGL ExJ8MGmuYSls91JI+OiCkQTRyTqQuZDYqTGgGHgSoQkOqOULiuE9ZyJu+xz5BH9feKt9kNvGizBA6 jsd1maV3B2Om1Yuwg3VQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6b-0003Ib-0d; Sat, 07 Dec 2019 23:03:17 +0000 Received: from smtp-out.xnet.cz ([178.217.244.18]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1idj6Q-00037D-Ah for openwrt-devel@lists.openwrt.org; Sat, 07 Dec 2019 23:03:08 +0000 Received: from meh.true.cz (meh.true.cz [108.61.167.218]) (Authenticated sender: petr@true.cz) by smtp-out.xnet.cz (Postfix) with ESMTPSA id 40BB441A3; Sun, 8 Dec 2019 00:03:04 +0100 (CET) Received: by meh.true.cz (OpenSMTPD) with ESMTP id dfd873dc; Sun, 8 Dec 2019 00:02:54 +0100 (CET) From: =?utf-8?q?Petr_=C5=A0tetiar?= To: openwrt-devel@lists.openwrt.org Date: Sat, 7 Dec 2019 23:52:57 +0100 Message-Id: <20191207225257.14135-5-ynezz@true.cz> In-Reply-To: <20191207225257.14135-1-ynezz@true.cz> References: <20191207225257.14135-1-ynezz@true.cz> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20191207_150306_537486_D2B37FE8 X-CRM114-Status: UNSURE ( 5.73 ) X-CRM114-Notice: Please train this message. X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [178.217.244.18 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record Subject: [OpenWrt-Devel] [PATCH uci 5/5] cmake: add more hardening compiler flags X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Petr_=C5=A0tetiar?= Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org In order to spot possible issues with direct impact on security during QA on CI (GCC version 6 and higher). Ref: https://developers.redhat.com/blog/2018/03/21/compiler-and-linker-flags-gcc/ Signed-off-by: Petr Štetiar --- CMakeLists.txt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 92adf4a47121..da4ac68c0139 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,15 @@ cmake_minimum_required(VERSION 2.6) PROJECT(uci C) SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") -ADD_DEFINITIONS(-Os -Wall -Werror -Wextra --std=gnu99 -g3 -I. -DUCI_PREFIX="${CMAKE_INSTALL_PREFIX}") -ADD_DEFINITIONS(-Wno-unused-parameter) + +ADD_DEFINITIONS(-Wall -Werror) +IF(CMAKE_C_COMPILER_VERSION VERSION_GREATER 6) + ADD_DEFINITIONS(-Wextra -Werror=implicit-function-declaration) + ADD_DEFINITIONS(-Wformat -Werror=format-security -Werror=format-nonliteral) +ENDIF() +ADD_DEFINITIONS(-Os -std=gnu99 -g3 -Wmissing-declarations -Wno-unused-parameter) +ADD_DEFINITIONS(-DUCI_PREFIX="${CMAKE_INSTALL_PREFIX}") + OPTION(UCI_DEBUG "debugging support" OFF) OPTION(UCI_DEBUG_TYPECAST "typecast debugging support" OFF)