Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp2756098pxb; Sat, 19 Feb 2022 23:09:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxaHVBN4RaM2ZOJs+lALFek5PmpYM+I2lOfniAbTvk4OJW8qufv00wQDuP4HsyVzYG7BUyN X-Received: by 2002:a05:6402:b62:b0:3e2:a75f:b949 with SMTP id cb2-20020a0564020b6200b003e2a75fb949mr15770510edb.62.1645340953813; Sat, 19 Feb 2022 23:09:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645340953; cv=none; d=google.com; s=arc-20160816; b=KbpGcWjkn5bKxepdGSqp/29a7TvJTfflZi+bNKER+W09qdGq+JSLFx3VFk6TrfDnIF QsXj31OiLRzfVFTKhCZ3Taxk4novHYAVIuv9pdNioIsIdyqMiFmfGQU/IUMSPq3GU+Gy qWNntS0C8YZ4OeyaZ/MowrigRs4veCdar8CXqh1WmWFsxeifrAjhJVmOuM258ngIm0fV HgUBgY5vU9Y8SDmvwCf/TX7qRl1+k/MziZjNEXi485kB9DnLn+qOxnCk1Fyu1SrDF+cp +zk70amSDnNWZ0H0e/RRKJHkIgvGiFgHbowMUfpz12hViFLhdamUnK5dgDgGt5BpUKH4 wO0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=C9S0KAwxEIvtCrO/D15JVJx6Fz48S13//eFCQ5KdSr0=; b=AslAAAkDAg317hDroKWDk88fg3t0QvE1PTOkBzNhvvMWUJIX17LOrREws72MdlPZTi RSyLf8AO4p8tghrAPsb+EyT4Ts6Kt40A/XyU1BGgyjpeELnbxsEpGyDQQof29Q9iH1bF 63gr/18+92o0+b8LmGh10Z3bl1DK1nP9AxuJpIYrTyqAtfi3B4zIcjlZ53qi75zMj89w Hvz4e2e9ZtLk4WSGX+qLAcT2oOrtl2jDw4JeIeS65+VfZ64KKba6X0OmKndE8fRrs/M0 6b5p2FLzl/RahJyIbd1tk/wGsaxoDLGJHDb/vuxv9bW+xNTzqMHe6czTZga+OOYXLv+b XPCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="NS/nptB6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hc36si8197199ejc.439.2022.02.19.23.08.51; Sat, 19 Feb 2022 23:09:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b="NS/nptB6"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235968AbiBRS4L (ORCPT + 99 others); Fri, 18 Feb 2022 13:56:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235302AbiBRS4K (ORCPT ); Fri, 18 Feb 2022 13:56:10 -0500 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58F5A24CCDB; Fri, 18 Feb 2022 10:55:53 -0800 (PST) Received: by mail-ej1-x62d.google.com with SMTP id p9so17083855ejd.6; Fri, 18 Feb 2022 10:55:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:in-reply-to:content-transfer-encoding; bh=C9S0KAwxEIvtCrO/D15JVJx6Fz48S13//eFCQ5KdSr0=; b=NS/nptB6vvX3DFxuXH9LAFzvvi4/H8pVOKKqtn4f5wNhQga6rHX2+X3s55OZLRrpfq yN7v3mxQbQpypnDoSc1sD9HQ6x+0HGNZbkmHyZtJf1rJtG+6dIAbHcXB2kwJhSDHb/Fz AA9a4xSmgjdOy0qQnZt3nOySCBGQgfBc1aFV/a5q71Et1YgCmX4An9g9vmxTnWh16QLf Z0xFgY9M7VwxtypQx1L5ifJjncao1/tgIBpCHa2DBIcx0MlExaunT0hvqBX1YHpsCr3N ZyB+njDi/fAAus9aC2m2UPIYJbzmPJgLQrAUO6cG/IdIrPtPD5sEuP6x+Lg9B5q3dMVX u+WA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=C9S0KAwxEIvtCrO/D15JVJx6Fz48S13//eFCQ5KdSr0=; b=Zo6HVwslfVeEQbqqOdST9+v9qHR6QSMHdtZnmi5wTxltxU9cpxL131GFDfu9vsMMRk Yf0ONbcADrM/H7av5fWoXRa8wZKecyK4QlbKzxACN1BJYy2afwpS+b23k8jBoSSUUxIh /wH2l7PAL557TvkkUAL2z4CQ9SHRKpROzMvbJZh1qeLfEXmZygdXEwZ4FTLjmKshabgU YFmEgKtQFgDAdHPwZJJzHzSJRO5f31yO6Bqz3/Y5SWPkuh/LYWCOp+2r89kkhjZsAx26 kybrIsDEzqJ/lQtpt+OFWSBRrPTgcOJrPWaR49ZRMpoyM3ZnjMPc3hqw6QcgrYgtqa10 YrVQ== X-Gm-Message-State: AOAM530v4h+lFg2kt9ayj2LWppDt21gpvSlcQClTnDclaJ4CT5P717YL qNNGcXP2SCmdnfgVQOzzdwYBQKKr/e+29g== X-Received: by 2002:a17:906:3bc9:b0:6d0:8d78:e7e6 with SMTP id v9-20020a1709063bc900b006d08d78e7e6mr5254159ejf.222.1645210551746; Fri, 18 Feb 2022 10:55:51 -0800 (PST) Received: from ?IPV6:2a00:a040:197:458f:c93a:90a3:1c34:c6d2? ([2a00:a040:197:458f:c93a:90a3:1c34:c6d2]) by smtp.gmail.com with ESMTPSA id y22sm5373205edc.41.2022.02.18.10.55.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 18 Feb 2022 10:55:51 -0800 (PST) Message-ID: <8043765d-2aa5-16ad-cc03-127398451e93@gmail.com> Date: Fri, 18 Feb 2022 20:55:49 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH 2/2] kconfig: Make comments look different than menus in .config Content-Language: en-US To: Masahiro Yamada Cc: Linux Kbuild mailing list , Linux Kernel Mailing List References: <20211213100043.45645-1-arielmarcovitch@gmail.com> <20211213100043.45645-3-arielmarcovitch@gmail.com> From: Ariel Marcovitch In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/01/2022 20:25, Masahiro Yamada wrote: > On Mon, Dec 13, 2021 at 7:01 PM Ariel Marcovitch > wrote: >> Currently, the same code that handles menus in the write to .config >> handles comments as well. That's why comments look exactly like menus in >> the .config except for the 'end of menu' comments that appear only for >> menus. This makes sense because sometimes comments are used as sort of >> submenus. However for the other cases, it looks kinda weird because one >> might attempt to look for the 'end of menu' for comments as well and be >> very confused. >> >> Make comments look different than menus. For the following: >> ```kconfig >> menu "Stuff" >> >> config FOO >> def_bool y >> >> comment "Some comment" >> >> config BAR >> def_bool n >> >> endmenu >> ``` >> >> The .config will look like this: >> ``` >> # >> # Stuff >> # >> CONFIG_FOO=y >> >> ### Some comment >> # CONFIG_BAR is not defined >> # end of Stuff >> >> ``` >> >> Signed-off-by: Ariel Marcovitch >> --- >> scripts/kconfig/confdata.c | 14 ++++++++++---- >> 1 file changed, 10 insertions(+), 4 deletions(-) >> >> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c >> index 9f2c22f46ee0..d3ec1ad67d92 100644 >> --- a/scripts/kconfig/confdata.c >> +++ b/scripts/kconfig/confdata.c >> @@ -880,10 +880,16 @@ int conf_write(const char *name) >> >> if (type == P_MENU || type == P_COMMENT) { >> str = menu_get_prompt(menu); >> - fprintf(out, "\n" >> - "#\n" >> - "# %s\n" >> - "#\n", str); >> + >> + if (type == P_MENU) >> + fprintf(out, "\n" >> + "#\n" >> + "# %s\n" >> + "#\n", str); >> + else >> + fprintf(out, "\n" >> + "### %s\n", str); >> + >> need_newline = false; >> } >> } >> -- >> 2.25.1 >> > > Since "# CONFIG... is not set" looks like a comment, > I am not sure if this improves the visibility. I agree that adding another '#' signs to the real comments doesn't solve the real problem here, being that kconfig uses comments to save actual information I guess this is for being able to check for a config in shell script with [[ -n $CONFIG_FOO ]]? Although if that's the case, leaving the config empty has the same effect, no? And then we can add a comment to the end of the definition stating that the config is unset. Something like this: CONFIG_FOO=y CONFIG_BAR= # is not set It may break scripts doing something like this: : ${CONFIG_FOO=?Config FOO must be defined} But they can be changed to use ':?' instead (which checks for non-zero length string rather than whether the variable is defined or not) Actually, now that I think of it, it might even be an improvement for scripts to be able to tell whether a config isn't defined or whether it has an 'n' value Anyway, I'm absolutely fine with delaying this patch until we find a solution > > I will not pick up this until I find out what a really good format is. Thanks!