Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1694263pxb; Wed, 9 Feb 2022 02:23:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6aQmV5TwQFAU8Yl1fZS/fbYCRmhMcGPY31rjPifKS+FXlOUDhE7Twd2ppE9cFUipoN3mU X-Received: by 2002:a63:4408:: with SMTP id r8mr1302813pga.101.1644402197992; Wed, 09 Feb 2022 02:23:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644402197; cv=none; d=google.com; s=arc-20160816; b=QzoDts2IW+ATc9oxbYbOIvsIRdOBSwJdt9pZgRnxyIXSvdwJDAIaYk8W0pIan0v6V5 tR3EQOcoJ3kY+0pc7WhNb8VQgM//Dn07PXJC+5LYWw22+XkuRDaFGnBXstMzzU+2OvbW Tg4HLqbRxgsg2dRMPcteJN/W49am/jGOT4GIS4DUjIlp3gbFpdNoBYTJCqP+d/ORoVAU UkZG6MvCFAIJ9TFCyAv1yL0OKiBKUHSeItlsD8dhlQ0TRJoBlshDJeIXRZC8jx8MaWSl m21B033oU9EDAkcOGo5aX93J/wUgNEwY3XHQ+ITesMyqaiddlnCAABy9p7kPDfUGVpsV nUEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature:dkim-filter; bh=QUV0hp+xB/5tu9Im52sNMR58mRLFLhMZGaIvBrJvw+Q=; b=mDAYxxaIYUARBuFuLKWdpk1VUisLj0zHeWP0wT38H21IqVG21bnx+hUA7mNrK+xKXU Y3DZu0aEt6Dr2UZ5UqlFmKxMaXfzSmF+TGoTXXt6kMmeYjq9SrSqFnidopABw5eeGIF/ xWdvreLITYW3GdbYZ9ku1Ew3bZgL7rr3xYu9y2iN6fSUOkUL44p4D2cR3ya9bxoQoIE0 DQGIe99F4SXXSSF7CV664xZ+2NvHrXklc1GqlA8Bt/u8yeQxHIlL33Ny28/hGmmRj8un qSbORjftxEEbNk9Y9P/HcZPuOZbbYgfSQrZGr0hAp/jBPHTbDVvC+9sktdhLQ6M2DrxO NqHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nbGi8Usz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id a1si14693771plp.572.2022.02.09.02.23.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 02:23:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=nbGi8Usz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 27AFBE00E154; Wed, 9 Feb 2022 01:19:24 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1389244AbiBGNvb (ORCPT + 99 others); Mon, 7 Feb 2022 08:51:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1387223AbiBGNrv (ORCPT ); Mon, 7 Feb 2022 08:47:51 -0500 Received: from condef-04.nifty.com (condef-04.nifty.com [202.248.20.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B97FC043181; Mon, 7 Feb 2022 05:47:50 -0800 (PST) Received: from conssluserg-01.nifty.com ([10.126.8.80])by condef-04.nifty.com with ESMTP id 217DjHnk028207; Mon, 7 Feb 2022 22:45:17 +0900 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) (authenticated) by conssluserg-01.nifty.com with ESMTP id 217DipVo022226; Mon, 7 Feb 2022 22:44:52 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 217DipVo022226 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1644241492; bh=QUV0hp+xB/5tu9Im52sNMR58mRLFLhMZGaIvBrJvw+Q=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=nbGi8UszpMuf1YuXNXjb4bnFhY+c9dLrABng6IGMik7U4321n/7HbUJiEz0rSAuDC 6cD4A4QDQ5ZU+ZIB75NLw9biK8HJe7RvuCE6Oaeah8sBtulkHBzMZaJ8ZqccnvR94T 8QHeSyXccMD9FivQxZQGxxCazVcbFqbzQ7w0olPVGraN8HduDChc5E+KU+1iik4bN4 RbJ84oePIAp5VJe3sLn6qaSWVUjD15FoE3+552Fyqti31sjqQKNUXnqw13oGq4IG/9 Mln10pW/GTzDiusmCo5z6XHTdkO+l0XGMWniv/oLV5MWBUqeAn5Nbur2rn3TDOHf/2 m6XeKpUxo8I+g== X-Nifty-SrcIP: [209.85.216.50] Received: by mail-pj1-f50.google.com with SMTP id p22-20020a17090adf9600b001b8783b2647so7391102pjv.5; Mon, 07 Feb 2022 05:44:51 -0800 (PST) X-Gm-Message-State: AOAM530WE848O1SolBsVKEVFNF6ZZb6/8pvz4oMm0Bq6Xar8WVOofkpr rjl/ndOur2T772pNwIXXNB4EMCtAEppOeT0YQew= X-Received: by 2002:a17:90b:1647:: with SMTP id il7mr18618035pjb.119.1644241491011; Mon, 07 Feb 2022 05:44:51 -0800 (PST) MIME-Version: 1.0 References: <20220128220131.10956-1-brenda.streiff@ni.com> In-Reply-To: <20220128220131.10956-1-brenda.streiff@ni.com> From: Masahiro Yamada Date: Mon, 7 Feb 2022 22:44:15 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] kconfig: let 'shell' return enough output for deep path names To: Brenda Streiff Cc: Linux Kbuild mailing list , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 Sat, Jan 29, 2022 at 7:02 AM Brenda Streiff wrot= e: > > The 'shell' built-in only returns the first 256 bytes of the command's > output. In some cases, 'shell' is used to return a path; by bumping up > the buffer size to 4096 this lets us capture up to PATH_MAX. > > The specific case where I ran into this was due to commit 1e860048c53e > ("gcc-plugins: simplify GCC plugin-dev capability test"). After this > change, we now use `$(shell,$(CC) -print-file-name=3Dplugin)` to return > a path; if the gcc path is particularly long, then the path ends up > truncated at the 256 byte mark, which makes the HAVE_GCC_PLUGINS > depends test always fail. > > Signed-off-by: Brenda Streiff Thanks, applied to linux-kbuild, (but I dropped the change to tests) > --- > scripts/kconfig/preprocess.c | 2 +- > scripts/kconfig/tests/preprocess/builtin_func/Kconfig | 3 +++ > scripts/kconfig/tests/preprocess/builtin_func/expected_stdout | 1 + > 3 files changed, 5 insertions(+), 1 deletion(-) > > diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c > index 0590f86df6e4..748da578b418 100644 > --- a/scripts/kconfig/preprocess.c > +++ b/scripts/kconfig/preprocess.c > @@ -141,7 +141,7 @@ static char *do_lineno(int argc, char *argv[]) > static char *do_shell(int argc, char *argv[]) > { > FILE *p; > - char buf[256]; > + char buf[4096]; > char *cmd; > size_t nread; > int i; > diff --git a/scripts/kconfig/tests/preprocess/builtin_func/Kconfig b/scri= pts/kconfig/tests/preprocess/builtin_func/Kconfig > index baa328827911..e9791a97f731 100644 > --- a/scripts/kconfig/tests/preprocess/builtin_func/Kconfig > +++ b/scripts/kconfig/tests/preprocess/builtin_func/Kconfig > @@ -25,3 +25,6 @@ $(warning,$(shell,printf 'hello\nworld\n\n4\n\n\n')) > # 'lineno' to the line number. > $(warning,filename=3D$(filename)) > $(warning,lineno=3D$(lineno)) > + > +# 'shell' can return more than 256 bytes of output > +$(info,$(shell,printf 'hello%01024dworld\n' '0')) > diff --git a/scripts/kconfig/tests/preprocess/builtin_func/expected_stdou= t b/scripts/kconfig/tests/preprocess/builtin_func/expected_stdout > index 82de3a7e97de..8e03e4dfe8f6 100644 > --- a/scripts/kconfig/tests/preprocess/builtin_func/expected_stdout > +++ b/scripts/kconfig/tests/preprocess/builtin_func/expected_stdout > @@ -1 +1,2 @@ > hello world 0 > +hello0000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000world > -- > 2.20.1 > --=20 Best Regards Masahiro Yamada