Message ID | 20201015055827.29410-2-rosenp@gmail.com |
---|---|
State | Deferred |
Headers | show
Return-Path: <openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org> 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=<UNKNOWN>) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.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=Zun6+1sR; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=c82gXqWR; 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 4CBdtm1yZ9z9sV1 for <incoming@patchwork.ozlabs.org>; Thu, 15 Oct 2020 17:00:31 +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:MIME-Version:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:References:In-Reply-To:Message-Id:Date:Subject:To: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PIrtzbCD2U4swG2DvZDLQicKkFQmHRYZC0mqWVDN0E0=; b=Zun6+1sRWUR+UF3OQUES6pqnwV HmhsCfgz661Uzy5vFjYDF0yxIdQsKBqwobn0EV5FUj3V9IUCfCH739ADgg5tdaOCV7FrPi/5Tj1RC CmjXHDKQUspxY2iUupnvMZk6gP4YRnNHoeqpYO4t+J35RehJ731uLjG+IKhzeZa2TcPs6RmolnIpJ q9jD2uNOUZoxE0djP3DBwHn8gPqkAjuBVZr8k9/dA/MRIYl3WNslZFq5ixAByGHjfVVfQOspVTQNw J9KfaF5VGG1zTuCJCLVW+G6e9iDDN5S6JdifM3cVfKN86pq5KAF/pTz2/7nmmfKONys5zbfGP34mO rB40Fxeg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSwHd-0008WV-4O; Thu, 15 Oct 2020 05:58:37 +0000 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kSwHZ-0008V3-Hj for openwrt-devel@lists.openwrt.org; Thu, 15 Oct 2020 05:58:34 +0000 Received: by mail-pl1-x629.google.com with SMTP id t18so1026244plo.1 for <openwrt-devel@lists.openwrt.org>; Wed, 14 Oct 2020 22:58:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=J6NZPsjJ7YCMZlrc8roUp6dqXAtc2mpvvPrnviICLCM=; b=c82gXqWREyZG+nwjEaRgpbT6LgEvStMQLh5mxsfbuc/MwU2UQ4O3uxsCKh7ZZwXLOC XaDhUUebC/dGWBGmmyZzXK3i33j01Hm5MNHlUQS24dZeyY9jJNLXNzpDgmdfq1wM+fq3 DLo6JbHEkI4p3CcJSDh2uwxhH8zxqb1hDYbx4aX4ZBSqPlBkjXRzWE90LYcqchV/yeGE jRsXIfAHcecl0AgQMDeeH2/W2DLBlIozQdP5QihR3hCTaTRNJCj4pH9h4+qptG9u94Q+ 5kp50hzP1gLmmJN3FE36CN1Uycw78Wm85wY0e0QyMySSZdhfRdvDw3jYVS9uurNUuiwa Z0nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=J6NZPsjJ7YCMZlrc8roUp6dqXAtc2mpvvPrnviICLCM=; b=pPYUvEZrpzhZ3Y/FN+vk+mUIB+RtmACOgcAIo7EbgjFhRBqIdVnQn5c66ud+vPxkdH KFdHNG+zaIEVPyXBtRXvbxycIR5HC7i9GNVRhj+4WOCtgJgZUceJbQtCsoeSXPhRRaGL AZDKt63Yto/Ig7sh6z3Xb2co0k+ezlcBD7IPOzCth9CRb7c2kUV0wUmhlcL96C1XZWrP FTSfIADjlZN22SxT8Fo6k7xihb1xjFcqn8lFSbcf6nmyBbs+uzROiKXggdpdEt1TIHnf DiPNhyjv2AKxPi/w7I7xElup5s9LUAdljekocNN8F0qAjVWtwchLCX3zZoRMwchz9Thb 1phA== X-Gm-Message-State: AOAM531PTlKsqWeX0l9YuNg/SWR1WP54o+QG7bhLXVzwmGmIQl2vRLYp WhkXICtxjvH/CFQ/Vt5hnv08G+ddp+7uoQ== X-Google-Smtp-Source: ABdhPJwCuB0IAMGVeF98d1lhxR1QOTPGD9IE4qC27oCCsa7UOGXRU+TbEdPW+rxF925V+jrHpE5UTQ== X-Received: by 2002:a17:90a:1f0b:: with SMTP id u11mr2747201pja.105.1602741511203; Wed, 14 Oct 2020 22:58:31 -0700 (PDT) Received: from DESKTOP-VIRSTQA.lan ([2001:470:1f05:79e:e928:5c7b:bcee:fb01]) by smtp.gmail.com with ESMTPSA id p14sm1584404pjo.46.2020.10.14.22.58.30 for <openwrt-devel@lists.openwrt.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Oct 2020 22:58:30 -0700 (PDT) From: Rosen Penev <rosenp@gmail.com> To: openwrt-devel@lists.openwrt.org Subject: [PATCHv2 2/4] base-files/functions.sh: do not iterate over ls Date: Wed, 14 Oct 2020 22:58:25 -0700 Message-Id: <20201015055827.29410-2-rosenp@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201015055827.29410-1-rosenp@gmail.com> References: <20201015055827.29410-1-rosenp@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201015_015833_613080_EC0C95B4 X-CRM114-Status: GOOD ( 13.08 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [rosenp[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:629 listed in] [list.dnswl.org] -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 -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List <openwrt-devel.lists.openwrt.org> List-Unsubscribe: <https://lists.openwrt.org/mailman/options/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=unsubscribe> List-Archive: <http://lists.openwrt.org/pipermail/openwrt-devel/> List-Post: <mailto:openwrt-devel@lists.openwrt.org> List-Help: <mailto:openwrt-devel-request@lists.openwrt.org?subject=help> List-Subscribe: <https://lists.openwrt.org/mailman/listinfo/openwrt-devel>, <mailto:openwrt-devel-request@lists.openwrt.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "openwrt-devel" <openwrt-devel-bounces@lists.openwrt.org> Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org |
Series |
[PATCHv2,1/4] base-files/functions.sh: read grep output by line
|
expand
|
diff --git a/package/base-files/files/lib/functions.sh b/package/base-files/files/lib/functions.sh index 59bb0fe711..61aa87b2dd 100755 --- a/package/base-files/files/lib/functions.sh +++ b/package/base-files/files/lib/functions.sh @@ -290,8 +290,9 @@ default_postinst() { include() { local file - for file in $(ls $1/*.sh 2>/dev/null); do - . $file + for file in "$1"/*.sh; do + [ -e "$file" ] || continue + . "$file" done }
From https://github.com/koalaman/shellcheck/wiki/SC2045 When looping over a set of files, it's always better to use globs when possible. Using command expansion causes word splitting and glob expansion, which will cause problems for certain filenames (typically first seen when trying to process a file with spaces in the name). Signed-off-by: Rosen Penev <rosenp@gmail.com> --- v2: replaced break with continue package/base-files/files/lib/functions.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)