Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp937963imu; Fri, 9 Nov 2018 08:23:17 -0800 (PST) X-Google-Smtp-Source: AJdET5csBZITZj7FetNHikmYtbGgFyAo0602VtWCVYaDs0SeFrV1HB6zUqWmHqtxczWeRULFl2f9 X-Received: by 2002:a63:f65:: with SMTP id 37mr7971915pgp.238.1541780597455; Fri, 09 Nov 2018 08:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541780597; cv=none; d=google.com; s=arc-20160816; b=oB8+4xuMOhr7n5ae9oIWCBD1OJV8dP33As6TiGKNcG1LCKUTw0KQF8Ar+uMajguJC5 +azPLlSyJ/mC53MsbINaUN44XfV2a8jMRZbSZAmbbWLxWtVnpSn06SJ2/Y4YNH7vSVdV cevIF07WZ8s36yqGf+x3gdFTthvmAdpic6JkTJ8tTT10igL6HioTZadn8QWOdJrUHayG RAGCa8wnh8ekL1lHbk1rWzX2FUn0gGrUp/lnBymaKYACF1OSWlpkmAq/GQwH3w6JvfCm fw73e8WJ7xdTpesnEH3t8bl9QxW76K6NIVJd6RJATBccD4VNniLEr//cC7aigRGwNdrh lyrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature:dkim-filter; bh=n3R2ykxv9WOpfLnl604x9uVs2D2nKLyud1GY4NFC/ik=; b=aSbj1soFKt/iDzaeZW822N7yULkaSzq5ycYUoKHcQETfqPo+n8fa5K/18ffYbdZMyD Zj2rmTJZ/WXNwoOZMDKBKoD8c5byXWKam+xaVY2C+ljkKzLtJy8BQDKkmggg1L1M473I s1O/0tx7WbPG8pJcm/u1NL6eO7iX0jZ61sOvutKI5eZsNWfEUhr0Nd4S0i+rLCp2dDyx dFihwEMcnhOFUzCuCGpRKIHWmkq2lUdFEws3tEv5JtcsweNmdHIJA7up+2FTUDAKL0e8 NbxbkdchfCMeCIUonPxfoj1In6K11Hg7FJ4BfYVCgcy0mOM1PkbLrdKDzTRrFWiAUCSp lZVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=RkSEhifg; 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 a8-v6si8150616plz.94.2018.11.09.08.22.30; Fri, 09 Nov 2018 08:23:17 -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=RkSEhifg; 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 S1728453AbeKJCCz (ORCPT + 99 others); Fri, 9 Nov 2018 21:02:55 -0500 Received: from conssluserg-01.nifty.com ([210.131.2.80]:56693 "EHLO conssluserg-01.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbeKJCCz (ORCPT ); Fri, 9 Nov 2018 21:02:55 -0500 Received: from mail-vs1-f44.google.com (mail-vs1-f44.google.com [209.85.217.44]) (authenticated) by conssluserg-01.nifty.com with ESMTP id wA9GLLGC003141; Sat, 10 Nov 2018 01:21:21 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com wA9GLLGC003141 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1541780482; bh=n3R2ykxv9WOpfLnl604x9uVs2D2nKLyud1GY4NFC/ik=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=RkSEhifgpxTGXnghSkcqIx9s7pRPyV6HqprhmQOYy070cVAh31F2HVTc9wLn+2Te3 qR8j3lnyGGoqY1PAIMT93ICJkl6BuRcH592l1qBoltBFV71X5xOAMAno7jNB8Gbz6y gq0f6G0Fd93QnYLFfghx1Ab1zCTebAe2yOxv6KycpfVo41gpYlMtAo+DCzA6vqYsfH wx4B7o7RUcQYFsk1+Ijfvf1LtchOqorTFOxt9CzD0ysCb6jKP/jyRS6vp6hzY1Z4vl wIqtKpVPrB4dSDOyFANrHSby1pNfG/NwXhypnp3M/I/iU2OoPlWSeWpbSrMHz5oIV9 RVnwiYP8fAWZw== X-Nifty-SrcIP: [209.85.217.44] Received: by mail-vs1-f44.google.com with SMTP id x1so1331987vsc.10; Fri, 09 Nov 2018 08:21:21 -0800 (PST) X-Gm-Message-State: AGRZ1gLz1ddGY/L64FRQOaiwy4Kqx8PWPJxqWkY4mEvqUd6vxSovWsHr n/bK/VdQHGNihmxcYBFD2JMSmnEXHfXv6ZtHbI4= X-Received: by 2002:a67:385a:: with SMTP id f87mr4077274vsa.179.1541780480439; Fri, 09 Nov 2018 08:21:20 -0800 (PST) MIME-Version: 1.0 References: <1541405976-13747-1-git-send-email-yamada.masahiro@socionext.com> <68478c42-2703-0d24-bf6b-8d75d024722a@mind.be> In-Reply-To: <68478c42-2703-0d24-bf6b-8d75d024722a@mind.be> From: Masahiro Yamada Date: Sat, 10 Nov 2018 01:20:44 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2] kconfig: merge_config: avoid false positive matches from comment lines To: Arnout Vandecappelle Cc: Linux Kbuild mailing list , Petr Vorel , nasser afshin , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Nov 5, 2018 at 6:35 PM Arnout Vandecappelle wrote: > > > > On 05/11/18 09:19, Masahiro Yamada wrote: > > 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 > > Reviewed-by: Arnout Vandecappelle (Essensium/Mind) > > Regards, > Arnout Applied to linux-kbuild. > > --- > > > > 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") > > -- Best Regards Masahiro Yamada