Received: by 10.223.185.116 with SMTP id b49csp4091863wrg; Mon, 19 Feb 2018 10:56:19 -0800 (PST) X-Google-Smtp-Source: AH8x227RLwSAHeOKtNyEfub6OLKtCdawoGHhye2hTo1unjEbN/TRSOye5kmqDuXS5CFupiUVAEfP X-Received: by 10.99.172.2 with SMTP id v2mr13279640pge.204.1519066579342; Mon, 19 Feb 2018 10:56:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519066579; cv=none; d=google.com; s=arc-20160816; b=k0Km9FgV4Ue4gsed0m+aFpK9aRBA8dRwiZubNfhE4AENmtkbOJYHmv1Ap/lPjLPQUt JPOIUjzmHIggWDi7q+nRQoIex+B6NC9J/WyQjpkZ321XiJNJrtsPQT3TZeySYalTrYXE etOoWUaWm69kO1FT6KlUJlXCer1hUZk+A0ZLYZOQPZ7R9VHC447GGlklUm9UelI8TpSz nOwgy46Dpp7f3aJb7HYGkx0uGI2uUEM5i9si2hlkWzr5csKHjogEgc/mQww5WayukBdY 97RNY9udbGRjJuuzZ/g7NtR0AB2MkX6uyOUPXzZhRJb62U6CPmTQzznsOXRG3DXgSzRi Lq2w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=ILL7YdXXEtVVLJiXrvzosQCYH4yzugjMg5I2Sim3PKs=; b=0AXdnvnQ/w8m8/v2YgPcS6o0hZhZuYryJPH4KI3PoEjEEMgutZAHJWyQzvAoephNyK k8UufN/TmjKOiApbQB13pKL9Wsp8rKo6nh/l7fCZIPMEH5aqso/lN4VIzZMgCkvE0FPl bjD1jbuSUg1e0IoMUQ17m3NpGlzTUr0W6ME51OkpvTgHsM45SG9oa4S11UuiVHSrIXIi WcdS8g55GnthKQ05X70bGbgZSaxSWGYY7gxUR0mXRefysO1Q3BSb0SSh/wI2s7Ng6cjv YdxbF1y/RNFo3TjnCjIngaJ3tjXRPSlkjnT6Dx2cPLVJ+Hg/GjXcnygFQzjc0mx2eHUx O+Mg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ImaAjAtv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a129si227267pgc.515.2018.02.19.10.56.03; Mon, 19 Feb 2018 10:56:19 -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=@gmail.com header.s=20161025 header.b=ImaAjAtv; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753626AbeBSSzC (ORCPT + 99 others); Mon, 19 Feb 2018 13:55:02 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:35897 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753460AbeBSSzA (ORCPT ); Mon, 19 Feb 2018 13:55:00 -0500 Received: by mail-lf0-f66.google.com with SMTP id t79so853832lfe.3; Mon, 19 Feb 2018 10:54:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ILL7YdXXEtVVLJiXrvzosQCYH4yzugjMg5I2Sim3PKs=; b=ImaAjAtvysY9txzIj1EbKMDEfQIj/OfBO6KfBHRwD1iLy36J2nZOJFdWejJnVZkX/w urX/dAIv337eyGXtmAqq951omnevaOgUCtwkN49BDv+8kWHCZhodLeJAgNihoglPyPHA wRFE39LkpdrBevZvnByqhSAFn73taJZaTXc6hJtfS5kH89MVdCDd2hr6ynHY5A3m1PPu lzhZBpHyMRBjSASaBXaM3NeiiMG8g9gX+3PoaYmp0r6w6aFdzYVwR5hDBKQk3MLvuWf0 mfLYHs+hLtfefpHfidbEyJGLnQaQHgpRYqB/uPwbhSTf8QNqJg2+DEuXg1Br2gQa3M7B k7Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ILL7YdXXEtVVLJiXrvzosQCYH4yzugjMg5I2Sim3PKs=; b=Meik5tdt5MX7Wjtl7w2ebgHGmCFiTK2zv54wcp0BlchPyXLE+6Cd13/hUw/rU3Cl88 mMqHXM3Nve6UNXt9qf2b+rpgkOTHKC8y9uXirQhbNEWxlgQswIrDSvPTVFUv5sYOXSVR JNWo1dF9K5cCdvx6CoZi7DhMuHErbFiK0UPEqS0xgQffvGdjJ4s4+61dVI5KARMtjfaA 23cNYp2kNCIlXxlc9RT1PdZS2XnAatRU1RGo8WHRdogagdE1eh7pJoYkZzg0J5p0ZFhB e7EEsf8++0ohFXuvnHhQTwWi/qNNyoUIvyp5HwMg9ivyF/uIcQo9ZH/wI8Gktnv5Epkt tKGw== X-Gm-Message-State: APf1xPDFQgOW8HEIUTfUM4mzZRZbAYBTpLEStZq41bzoc4YRJKQTRTZO Bv4IAdKsoU6Hb/kOqrifMrw= X-Received: by 10.46.49.10 with SMTP id x10mr3983951ljx.94.1519066499095; Mon, 19 Feb 2018 10:54:59 -0800 (PST) Received: from huvuddator (ua-213-113-106-221.cust.bredbandsbolaget.se. [213.113.106.221]) by smtp.gmail.com with ESMTPSA id 18sm1750182ljt.94.2018.02.19.10.54.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 19 Feb 2018 10:54:58 -0800 (PST) Date: Mon, 19 Feb 2018 19:54:44 +0100 From: Ulf Magnusson To: Linus Torvalds Cc: Masahiro Yamada , Linux Kbuild mailing list , Greg Kroah-Hartman , Arnd Bergmann , Kees Cook , Randy Dunlap , Sam Ravnborg , Michal Marek , Linux Kernel Mailing List Subject: Re: [PATCH 11/23] kconfig: add 'shell-stdout' function Message-ID: <20180219185444.o6p2v7qtl2fg5r35@huvuddator> References: <1518806331-7101-1-git-send-email-yamada.masahiro@socionext.com> <1518806331-7101-12-git-send-email-yamada.masahiro@socionext.com> <20180219044845.7cnqpgyiinn6hkyb@huvuddator> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 19, 2018 at 10:01:49AM -0800, Linus Torvalds wrote: > 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_. > > Which is actually what we want there. > > Hmm? Is that too nasty? > > Linus One minor drawback would be slight kludginess if you want "n"/"y" put into a string depending on the success of a command: default "foo-$(shell cmd && echo y || echo n)" As opposed to: default "foo-$(success cmd)" I don't know if that's significant enough to matter in practice. Keeping it objective, I can't see any major downsides, though I'd really prefer to just have $() do string interpolation within "". That keeps the implementation trivial and makes the behavior and limitations obvious once you know that n/m/y is just shorthand for "n"/"m"/"y". Cheers, Ulf