Received: by 10.223.185.116 with SMTP id b49csp271519wrg; Tue, 20 Feb 2018 21:02:45 -0800 (PST) X-Google-Smtp-Source: AH8x226ohQWD26burYtqo+YLUc0xlhzA4dwZFhopptYNyaWcwSTCLezwD3snfcC1g7rYzNCb5qO7 X-Received: by 10.99.139.199 with SMTP id j190mr1716188pge.334.1519189365428; Tue, 20 Feb 2018 21:02:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519189365; cv=none; d=google.com; s=arc-20160816; b=w4pxDBNAaSgy9j5DgkOjOrEuRMzr2G5yBlUeV2VNddx7imB59Xm1lz4k+oseHiUwew Cz/XdgwZU30/AZ5bILSEbpOSlchnkgLTNEMzLg3t9JcqMy0QcU1eYkPvoytRMQMz53D0 bB+9eGlvf73ro6skZyWWYyukZ4ruQECH2p1K4sn7t95A0H0uf3gBi8fdidNQbDh6Z2Z9 VJosmNTZSDLhYHs3mosBkBrEcpsoN6gt+VziYaZRGSy/uHKzkPT+1accLo/9eglejfQG cDu3XHuvp5kJwh6c0VGE3plF8ysqunlyTJey77FsLhBnJ/oMFBk0OTghdYORxmfsyiiN kpVw== 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 :references:in-reply-to:mime-version:dkim-signature:dkim-filter :arc-authentication-results; bh=aPzwcgNxfDELSgo/zdoyvVmxOEouKH+6eOBaavdNmq0=; b=sxES0ZJMaK41MWLNBp1P0/HE3sPPtKNwKmH53uje/KpF76D3MjrAtRXAE+lemd/gea wh2AWkDvz6fysQG9AbuF8gTUjkPJZU1Tzi2mTm7TfGDn7/JUlV4hU3/x8grIu6HBByXB R4z0UNacUf6iH5Hp/026VOYTgyy+q1b50X3C1eoWSNswaK57G2juoOg4kl5s4uVn8Hln uYdB+2YhaSmwKlVgd3Wb08A//2PuRm7UVUfKXomem8ZwmUR4SfCEXSJkrja8vF4r/0VI GRT+AKQ9UrPzKlOgKThPzOeSdYAUIqXVKDRM04Ho2GsSdS3TnGK9EhablVnKTpETOFHf eQuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=WkXy2Bod; 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 13-v6si810099plb.515.2018.02.20.21.02.17; Tue, 20 Feb 2018 21:02:45 -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=WkXy2Bod; 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 S1750805AbeBUFA4 (ORCPT + 99 others); Wed, 21 Feb 2018 00:00:56 -0500 Received: from conssluserg-02.nifty.com ([210.131.2.81]:58316 "EHLO conssluserg-02.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750707AbeBUFAy (ORCPT ); Wed, 21 Feb 2018 00:00:54 -0500 Received: from mail-vk0-f50.google.com (mail-vk0-f50.google.com [209.85.213.50]) (authenticated) by conssluserg-02.nifty.com with ESMTP id w1L50eVv019041; Wed, 21 Feb 2018 14:00:40 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-02.nifty.com w1L50eVv019041 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1519189241; bh=aPzwcgNxfDELSgo/zdoyvVmxOEouKH+6eOBaavdNmq0=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=WkXy2BodAfAcN1GOpsv2kz+FgPk69DotKM4Qavtoh+9UwroFhFLvvqwic/BK8Gqbk xVfx3emHiHT5mnXYjmEuCQllVhazedZcNEUQCOx4ECsISvaBbkX6warLB+aSQYC+MQ 0jkvmq3grgYmfI3l3LqnYCAwOuc7KRJ7N7RBGkRUpSF903TjKgaZ/AIfPMaKTePzzw wds0fvR+p3k/0rXse0twkwvfsKlcD25ZWH0kNaeQerLH8cKtlIDwbX+2MHuJOvUDBs K041YuuBKcY3/XpkUzWqc0RmYFdalycPFwdsUNJu62VlKB3ygd4VWpK4mIYFUCw+UF xjVfDZK1k0qbg== X-Nifty-SrcIP: [209.85.213.50] Received: by mail-vk0-f50.google.com with SMTP id o17so248640vke.7; Tue, 20 Feb 2018 21:00:40 -0800 (PST) X-Gm-Message-State: APf1xPAOSn7oanczFcqpB32OrgcDTxxXTBwSb8/w57R3yMfB9xFAS/Bj 7C64foa9PeYpphG0pQAiIcVVTXyGYd9ZcXhSHxY= X-Received: by 10.31.33.68 with SMTP id h65mr1486040vkh.65.1519189239699; Tue, 20 Feb 2018 21:00:39 -0800 (PST) MIME-Version: 1.0 Received: by 10.176.83.212 with HTTP; Tue, 20 Feb 2018 20:59:59 -0800 (PST) In-Reply-To: References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> <1518806331-7101-12-git-send-email-yamada.masahiro@socionext.com> <20180219044845.7cnqpgyiinn6hkyb@huvuddator> From: Masahiro Yamada Date: Wed, 21 Feb 2018 13:59:59 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 11/23] kconfig: add 'shell-stdout' function To: Linus Torvalds Cc: Ulf Magnusson , Linux Kbuild mailing list , Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , Sam Ravnborg , Michal Marek , 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 2018-02-20 3:01 GMT+09:00 Linus Torvalds : > On Mon, Feb 19, 2018 at 9:44 AM, Linus Torvalds > wrote: >> >> I do like your "success"/"stdout" more than "shell"/"shell-stdout", >> because with that naming I don't get the feeling that one should >> subsume the other. > > Hmm. Thinking about it some more, I really would prefer just "$(shell > ...)" everywhere. > > But it would be nice if perhaps the error handling would match the > context somehow. > > I'm wondering if this might tie into the whole quoting discussion in > the other thread. > > Because the rule could be: > > (a) unquoted $(shell ) is a bool, and failing is ok (and turns into > y/n depending on whether successful or failing) > > So > > config CC_IS_GCC > bool > default $(shell $CC --version | grep -q gcc) > > works automatically. > > (b) but with quoting, $(shell ) is a string, and failing is an error > > So > > config GCC_VERSION > int > default "$(shell-stdout $srctree/scripts/gcc-version.sh $CC > | sed 's/^0*//')" if CC_IS_GCC > default 0 > > would need those quotes, and if the shell-script returns a failure, > we'd _abort_. GCC_VERSION is int type. Setting aside the Kconfig internal, I prefer 50700 to "50700" According to my common sense, I do not want to quote integers. IMO, I prefer to use different names for different purpose. So, 'stdout' and 'success' look good to me. BTW, I noticed just one built-in function is enough because 'success' can be derived from 'stdout'. So, my plan is, implement $(shell ...) as a built-in function. This returns the stdout from the command. Then, implement 'success' as a textual shorthand by using macro, like this: macro success $(shell ($(1) && echo y) || echo n) macro can be expanded recursively, so cc-option can be implemented based on 'success' macro. -- Best Regards Masahiro Yamada