Received: by 10.213.65.68 with SMTP id h4csp22949imn; Tue, 27 Mar 2018 20:42:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+thaLyw+0m4LD16FY+PjgJJWPxMsly3+ps6CV26K0c6eywZBW8o0LP7YGPnxSANkqJDwLy X-Received: by 10.101.100.24 with SMTP id a24mr1322663pgv.7.1522208575468; Tue, 27 Mar 2018 20:42:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522208575; cv=none; d=google.com; s=arc-20160816; b=fIXEb3zjRdx/K84zgPAdJ0n5B2+HQa1EUTIy1/WmpAAsrvNf2+OtG5xUfHXqhPhyK4 ePCEprYb/oXBhw162LGEyZAUPr+7RrT70qbNC+r4EnuBZ5QPgHDu78vmLzr2H2/bC7/q RErz1P41u6rDGeMMJJiSqCSD9Lmc9xNDroPxBSoaauQMJsOwHZFcRJQNihl0m++V7ZQ/ /czDS3ZeYXjcfLYspxux9pb9TCZDbyxnPOqoEK5IiemZacjLf/77YG/7Mb84CVT3eiav r85CeBUPi1XuoCl1hiWWSkAIW0eKE9OV2pMlY7OgAO4mNU8IpdnoxB7ccWPmxZ1EIFzv NV+w== 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-signature :arc-authentication-results; bh=/IJKYrUhR5ieU9b/mUouTnAYyuyTb3PLEXpEDNy3dS8=; b=AHqyypM04GnHh5F0/dBdY0fIABP6PNvoiZGod6+64IS55HEwpt6hRlMczjKVgoAO+1 TK7Q+novnXtvxD1KonwKhasYvgLB64O5UuCke8xBDvp6tkSYc5cT9TO2Hlo2e6WfEieq Fjen3cR+yDZDzGaA/q91RNledlayLokJqb71l67Qy3l7KgAZ0D7c/nDqgw45W6kMASOS qpxEnmLhst4ErHKBq+fPgG9at+Lhn9dxcropIPzZtmND9+Xy8tlBELy40eI4SugaRCL9 BShk8DayMY2yOUc8/H+QpLmmbDw+q6Sm/nHWi/L0vsTlnQuxvyp2eS3CDGMWFES/wc+8 uLiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=mA4vd0Br; dkim=fail header.i=@chromium.org header.s=google header.b=EJNV75DS; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y11si2010033pfe.49.2018.03.27.20.42.39; Tue, 27 Mar 2018 20:42:55 -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=fail header.i=@google.com header.s=20161025 header.b=mA4vd0Br; dkim=fail header.i=@chromium.org header.s=google header.b=EJNV75DS; 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=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752383AbeC1DlV (ORCPT + 99 others); Tue, 27 Mar 2018 23:41:21 -0400 Received: from mail-vk0-f66.google.com ([209.85.213.66]:38834 "EHLO mail-vk0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751207AbeC1DlU (ORCPT ); Tue, 27 Mar 2018 23:41:20 -0400 Received: by mail-vk0-f66.google.com with SMTP id b16so606214vka.5 for ; Tue, 27 Mar 2018 20:41:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/IJKYrUhR5ieU9b/mUouTnAYyuyTb3PLEXpEDNy3dS8=; b=mA4vd0Brv11CnIVyREwp7GMy4F2YsYNrtejcrVy+cfIYFMJ35sIHqBgtoO3dNDS8Cs aFXEnBMznWEPDUAhc8WsVHYTIkJQMvk8Z3EUuxHn9KruCnqAfGCJVi8qNEb2cK8y0Mep yn1OFz774UCrVqSiXwI5TPpmkSvEZnGy7mc4bmVD1JJI+e05YwPt81v+zqdi3SIZ9MZI 2GSYC4nFMsL05ZGflzD2pMtSJAqoqvbwR0u1rFX4anqi2rA42i+5fUdMs9mef9VbUbui B0XulGnUrNoPjTAZ1B3ImoCgtczC9JlA8QsBDNp72LNbIfQgLkkfU0Dl6qp+7AwW1Tk8 f3CQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=/IJKYrUhR5ieU9b/mUouTnAYyuyTb3PLEXpEDNy3dS8=; b=EJNV75DShbMPv0dqk/o2TObNvk3lituL3sKUZp4bTqqxcgjGG6wDUr6BeELj3L0pHC Sv3BmxayEANxGz8u7mwOHvMU1By/wvcip9RlyXhg2cvi398ggzY4M+Hib3K3LNbI4ryq 0BacowUA4edn8IekodtsfAV1bLqJQwN6s9dI0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=/IJKYrUhR5ieU9b/mUouTnAYyuyTb3PLEXpEDNy3dS8=; b=TGZpLc5ig3SlVj+6NHJHHK2IHUdpL1mC3LWDwwh5iR7HsGGAkq9fD+Gv2yMv38iRHA wegROVPZ4iLjAeGCsawwQn+j3S74S+k1FJJcVK3eGdGjAnTeYErq2jifi00O+t0gCxTw FFROICWk0sDz0qS+QszhU7gBa5GXDugZAnaslUxKBvFvw4mYEAMSdn6BvWpJ1bf/U3GN h92zrWE6X4zrBy2dOUyMztwvEYn5l0vLWghXyS3wkUX0a4wRHbuLUVvsbc7kmUtU2cyy VcWQQsjCPqEDX5r5ka52nw92jGottIqq4UB7eK/yDSGWErNQoUUe40iL5d9L1llkJcxl 4MMw== X-Gm-Message-State: AElRT7Hxps9yQJ8nEN8ikRcnlvW1TG/FrYq0qo0jRnr5GUGsmOaZhLUz wFtOVRSWMgJE2QSjefIixGZPCK4QTt8ohNeiZRlKGA== X-Received: by 10.31.65.11 with SMTP id o11mr1227335vka.149.1522208479183; Tue, 27 Mar 2018 20:41:19 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.129.9 with HTTP; Tue, 27 Mar 2018 20:41:18 -0700 (PDT) In-Reply-To: <1522128575-5326-8-git-send-email-yamada.masahiro@socionext.com> References: <1522128575-5326-1-git-send-email-yamada.masahiro@socionext.com> <1522128575-5326-8-git-send-email-yamada.masahiro@socionext.com> From: Kees Cook Date: Tue, 27 Mar 2018 20:41:18 -0700 X-Google-Sender-Auth: me81P8u1bJj0BB1Z15TtSsMFuOQ Message-ID: Subject: Re: [PATCH v2 07/21] kconfig: add function support and implement 'shell' function To: Masahiro Yamada 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 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. 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? Beyond that, looks good! -Kees -- Kees Cook Pixel Security