Received: by 10.192.165.156 with SMTP id m28csp370605imm; Fri, 13 Apr 2018 00:14:32 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Sa/a3GMVrNyiWb9BICDE8tLWqEiwXWyFW+EZFLa/kdAO/9+4ASPuaqblCKQM2Xcc0jHM4 X-Received: by 2002:a17:902:5a0b:: with SMTP id q11-v6mr4184330pli.199.1523603672674; Fri, 13 Apr 2018 00:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523603672; cv=none; d=google.com; s=arc-20160816; b=j424VrYGS5ZjCb8xNbPdNKxiqFTmS13sR978wFTQ22ny8G9rmF5yLbtzbT3iRY6YSN 29FhRnmd/p0rJMISBaEvfl2HIfQ6imr+w1g+7FAjMLU69Rlm0nyHq3pTL/s2vMai8Rhk ea2fp4WPn1ZHtAaFNedclRaomWEiMpDPXhMbg378wxEblyivtnSUEvkyzpwpwYLAQIBE pBSaSUEf6Gnp6iG/iW0ds0ucVH23csKz26lreTzE47cHEu0SHKJ0RZS+lW1jtKl4wmh0 OGfbxul1KK2DVsC1/XgY58nmhpwIDQqFtnjmeEUSHFn7z6bPyYKck8rzh+jQDCT8591R j5dQ== 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=cqRIlU67AzjPleraSReUpt1bgj6A9wYd5JzK3OqeOuc=; b=uYhtqr5HbrO4TkhOIlNO+mjHIbiqNTzDwRZN18OR+VuZs05a51df7J/XuTA2zQwJUz +jqnKwazGgn9NVrnGxajhTrXTrS5BDZJnCAq+TpXqm9p3qvlPKprssKRvH+FfqYeJ/sy G7xOccIfIK952eVayfFBVX+Ze/RMpzsv0+wniEfIQKLF6pEgKBIW6wfvmJubdtyd1z/W gQyia/NPEqEXNMVEq/F4UtmOS2VkBgSlVtpyAhHAyM3n4L+S9Or9P2qQoA4qAFFd4QOH tSl2se1RSatwbj9YXwKffB1ViCpkmzpQjLnDRJA2dYHNTH4nXaqTkrS7u827LkAkyUXw Rfqg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=se7O8vd5; 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 x11-v6si5056140plm.326.2018.04.13.00.14.18; Fri, 13 Apr 2018 00:14:32 -0700 (PDT) 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=se7O8vd5; 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 S1752899AbeDMFdb (ORCPT + 99 others); Fri, 13 Apr 2018 01:33:31 -0400 Received: from conssluserg-04.nifty.com ([210.131.2.83]:18796 "EHLO conssluserg-04.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750839AbeDMFd3 (ORCPT ); Fri, 13 Apr 2018 01:33:29 -0400 Received: from mail-ua0-f176.google.com (mail-ua0-f176.google.com [209.85.217.176]) (authenticated) by conssluserg-04.nifty.com with ESMTP id w3D5X1Ys001319; Fri, 13 Apr 2018 14:33:01 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com w3D5X1Ys001319 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1523597581; bh=cqRIlU67AzjPleraSReUpt1bgj6A9wYd5JzK3OqeOuc=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=se7O8vd5r1ZFYk18WHXefSr1j9fUkgRRdIgUqyxps0f9cL7PjCEjZnN8ST2Ze/dqr YiJs4zqJSTW074FLolHfBPARJRgZaAmC491RChmFF6q+/o/KmqvQmpSexr1ETv+XAY I0MgtvLhQUdX9KvVToniTFpyV/JUjDx0Vub15fIXNDBJ6iu9kLbCW/Kwdmq9RuxGe5 WAj1cp+VBdslNVIGwzj9TR8w+M2mFGMProXDontrh3Jsq1DWJcDE7T0SMnjT76hoXW 3QpOJNIw4pCSCMsUzFECPP1XahROsUcIC9DYdGngvrrYkzMsZgIqiqPgyHOAaUCSf2 5rYZfI9BPQy0g== X-Nifty-SrcIP: [209.85.217.176] Received: by mail-ua0-f176.google.com with SMTP id u4so5039250uaf.10; Thu, 12 Apr 2018 22:33:01 -0700 (PDT) X-Gm-Message-State: ALQs6tAXhNj7C+vXN9YXxmKmKQQbyGRg2hVbsj1lQVcXAkPep7P5cWkK ARO6sMo01PgZt8OF3eYq0PzRuvrxBNMTtZXjbxc= X-Received: by 10.159.58.238 with SMTP id q46mr2162753uag.52.1523597580331; Thu, 12 Apr 2018 22:33:00 -0700 (PDT) MIME-Version: 1.0 Received: by 10.176.29.150 with HTTP; Thu, 12 Apr 2018 22:32:20 -0700 (PDT) In-Reply-To: References: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> <1522128575-5326-8-git-send-email-yamada.masahiro@socionext.com> From: Masahiro Yamada Date: Fri, 13 Apr 2018 14:32:20 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 07/21] kconfig: add function support and implement 'shell' function To: Kees Cook Cc: linux-kbuild , Sam Ravnborg , Linus Torvalds , Arnd Bergmann , Ulf Magnusson , Thomas Gleixner , Greg Kroah-Hartman , Randy Dunlap , "Luis R . Rodriguez" , Nicolas Pitre , LKML 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-03-28 12:41 GMT+09:00 Kees Cook : > On Mon, Mar 26, 2018 at 10:29 PM, Masahiro Yamada > wrote: >> This commit adds a new concept 'function' to do more text processing >> in Kconfig. >> >> A function call looks like this: >> >> $(function arg1, arg2, arg3, ...) >> >> (Actually, this syntax was inspired by make.) >> >> Real examples will look like this: >> >> $(shell echo hello world) >> $(cc-option -fstackprotector) >> >> This commit adds the basic infrastructure to add, delete, evaluate >> functions, and also the first built-in function $(shell ...). This >> accepts a single command to execute. It returns the standard output >> from it. >> >> [Example code] >> >> config HELLO >> string >> default "$(shell echo hello world)" >> >> config Y >> def_bool $(shell echo y) >> >> [Result] >> >> $ make -s alldefconfig && tail -n 2 .config >> CONFIG_HELLO="hello world" >> CONFIG_Y=y >> >> Caveat: >> Like environments, functions are expanded in the lexer. You cannot >> pass symbols to function arguments. This is a limitation to simplify >> the implementation. I want to avoid the dynamic function evaluation, >> which would introduce much more complexity. >> >> Signed-off-by: Masahiro Yamada >> --- >> >> Reminder for myself: >> Update Documentation/kbuild/kconfig-language.txt > > Yeah, this needs to be included here, especially given the "cannot > pass symbols" aspect which might surprise people. > >> [...] >> +/* built-in functions */ >> +static char *do_shell(struct function *f, int argc, char *argv[]) >> +{ >> + static const char *pre = "("; >> + static const char *post = ") 2>/dev/null"; > > Right now the search and help screens in menuconfig just show the line > a config is defined and nothing more. I think it would be extremely > handy to include shell output here in some way. The current implementation cannot do this. The $(shell ...) has already expanded before the parser receives tokens. There is no way to know whether a token came from a source file as-is, or it was derived from textual substitution. > Especially when trying > to answer questions like "why aren't GCC plugins available?" it's got > quite a bit harder to debug. > Could we capture the output (especially stderr) for these kinds of hints? For example, it would be possible to dump the result of $(shell ...) evaluation into the console in debug mode. > Beyond that, looks good! > > -Kees > > -- > Kees Cook > Pixel Security > -- > To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- Best Regards Masahiro Yamada