Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp283351imu; Mon, 5 Nov 2018 00:22:22 -0800 (PST) X-Google-Smtp-Source: AJdET5cABWh0n/XTx0k4opxjN9I0gWxrOC98YaJHyyJGhchLJ70PxP1jFZtiTD61sWcrSDB6q4M9 X-Received: by 2002:a63:e54:: with SMTP id 20-v6mr18031055pgo.369.1541406142801; Mon, 05 Nov 2018 00:22:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541406142; cv=none; d=google.com; s=arc-20160816; b=UclRHt3hdcsDAv5n4zbemIQGHEDuXsaQoZ7+RhKlvejpTjZpUFQ97PgKGTmy7RSiZV dXjnNAc+/9sbzM7yLLo5vAm2II+ygY7rToS/DcSsPSkrfUf6Aq8/SOv3r8f1vK4ZqOAl CtL50dyaSuHYqM5Qhw0uEWHNGmmu/X961CmeENAOFg4wPdgbXmvpY4kqEqxfsU9Egymi 1jcfDhW/FclCvwXAlDz/pFv4p9+onuaSl226qhF0ijqzuVBCTCgzWonzOpStJ3hG+ecb ctqG1mvWLHWdJrFeEobo1nBOr31y0ygshkjxGsLuGRe6joS+doU0PTXuuwTOEcKXZqLd 9U4g== 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 t1-v6si42794788ply.279.2018.11.05.00.22.07; Mon, 05 Nov 2018 00:22:22 -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 S1727371AbeKERiv (ORCPT + 99 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(-) 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") -- 2.7.4