From patchwork Mon Nov 5 08:19:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 150151 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp2317580ljp; Mon, 5 Nov 2018 00:20:23 -0800 (PST) X-Google-Smtp-Source: AJdET5cYZr/s2o4vQ2CLukOdp5kWsYUw6NUmjqh7qaI2htuVvSb7HHijLsscAVCyjXI6s3GGyp1F X-Received: by 2002:a65:4244:: with SMTP id d4-v6mr19325793pgq.289.1541406023450; Mon, 05 Nov 2018 00:20:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541406023; cv=none; d=google.com; s=arc-20160816; b=Uw3mwPi2jtSqa7oYo87V/l1PvEqTbpPvC9Gr1zmk9tXOEBl85eIZ1tuzXO03l99ZR/ eA9CApsrPxuKG2NhiSgPIPTwzQcov+BaGNsSpCIwH62quII9vaPCpSwwrrF/SI/qkeQ0 6YCLE9p7Vrl68DWXQAONFwnXjsM1kzj7Tp8fWodkq24LUXv0/MlqX+ejUjTrOB4vC7p3 q77iNHBqfI8RfhudaZynCZQ781g9xW9BAs0O5tSF14FakHw/noZio7t8MHV0es1huJ07 RqWpNe96cZR3YTXuzY+jHUvUQkV2N08mSMJc4oBp0TBrauk7OZpQeBr/7/k/8moSU/bz AD8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=wMzryw0mLtxTHiqcq3RT11/GwjAwgOC8w0PnRUCWflk=; b=coAFB6zZG4c8/Qd5sM0zuKJ0jbH/mBYXFRtrQvwVBQkjf5u5e0vUzPdqVATMtI6CRC TLDOnUYImX6pj6UnYLgrHfhfLU3oDxgimnaE3QW2s2joY1sNdricY6dR7qZoaL5sncCe PMxttBSMQ+8jG+iQy4VN9ENw3ckaP/LCoYl1qimvFnfxB5uhm24zfUtzFo6ciUCqe7wX 3kAO9TgImV5lJwT/4p2gguRDE9T+ytm4y9DTS8k+jaubWe4LXqHkHYb9i8eEQcFmlozH zXNyINwcGe0gb3FQNNM3ipNm6tlJvwnGU1bQcdk6TDWyzTqWBorOTemcaO7xBTPbOqv2 YpxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=x6vfM2uz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s2-v6si41059605plp.139.2018.11.05.00.20.23; Mon, 05 Nov 2018 00:20:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=x6vfM2uz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727396AbeKERiv (ORCPT + 32 others); Mon, 5 Nov 2018 12:38:51 -0500 Received: from conuserg-09.nifty.com ([210.131.2.76]:50915 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726133AbeKERiv (ORCPT ); Mon, 5 Nov 2018 12:38:51 -0500 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id wA58JkVF029160; Mon, 5 Nov 2018 17:19:46 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com wA58JkVF029160 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1541405987; bh=wMzryw0mLtxTHiqcq3RT11/GwjAwgOC8w0PnRUCWflk=; h=From:To:Cc:Subject:Date:From; b=x6vfM2uzPte8zLLS/C/E7f35O0yw8Bf3i2s8Xan1wvcgTBeFgPKF8eyevR5PkZWaE JA8jmaiiKSu4TjF8msQxdjg172e6ar34csvh43uW1mwU0AlSe4WLQghGZCb1YubL8G Od23isZe41AVNCOiWdzfyWVaIyEf2EJlGwLjC4V2b65HgWUv1ciuEitW4CGK4poddQ ureosqFjonE5gTTSOvEcyGNDwpE91aWzSc/qq3Hg7bP9NkEZ6DG1qhqrorOILknshe PS7c+dQ+wUGr9Nqe7BG7DMYLqrWu3VELeHtMm74Wz/Z94M+n4+k8HAW/QZA0Bkg2wa im0W5BpHHRfKw== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Petr Vorel , Nasser , Arnout Vandecappelle , Masahiro Yamada , linux-kernel@vger.kernel.org Subject: [PATCH v2] kconfig: merge_config: avoid false positive matches from comment lines Date: Mon, 5 Nov 2018 17:19:36 +0900 Message-Id: <1541405976-13747-1-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The current SED_CONFIG_EXP could match to comment lines in config fragment files, especially when CONFIG_PREFIX_ is empty. For example, Buildroot uses empty prefixing; starting symbols with BR2_ is just convention. Make the sed expression more robust against false positives from comment lines. The new sed expression matches to only valid patterns. Signed-off-by: Masahiro Yamada Reviewed-by: Petr Vorel --- Changes in v2: - Another (more precise) implementation approach based on the option from Arnout Vandecappelle. This is still easier to read, but adds a bit duplication. scripts/kconfig/merge_config.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) -- 2.7.4 Reviewed-by: Arnout Vandecappelle (Essensium/Mind) diff --git a/scripts/kconfig/merge_config.sh b/scripts/kconfig/merge_config.sh index da66e77..0ef9064 100755 --- a/scripts/kconfig/merge_config.sh +++ b/scripts/kconfig/merge_config.sh @@ -102,7 +102,8 @@ if [ ! -r "$INITFILE" ]; then fi MERGE_LIST=$* -SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" +SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" +SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) @@ -116,7 +117,7 @@ for MERGE_FILE in $MERGE_LIST ; do echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 exit 1 fi - CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) + CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) for CFG in $CFG_LIST ; do grep -q -w $CFG $TMP_FILE || continue @@ -159,7 +160,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $OUTPUT_ARG $ALLTARGET # Check all specified config values took (might have missed-dependency issues) -for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do +for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG")