linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 4.19 06/11] kconfig: let 'shell' return enough output for deep path names
       [not found] <20220215153104.581786-1-sashal@kernel.org>
@ 2022-02-15 15:30 ` Sasha Levin
  2022-02-20 10:01   ` Pavel Machek
  0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2022-02-15 15:30 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Brenda Streiff, Masahiro Yamada, Sasha Levin, linux-kbuild

From: Brenda Streiff <brenda.streiff@ni.com>

[ Upstream commit 8a4c5b2a6d8ea079fa36034e8167de87ab6f8880 ]

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=plugin)` 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 <brenda.streiff@ni.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 scripts/kconfig/preprocess.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/kconfig/preprocess.c b/scripts/kconfig/preprocess.c
index 389814b02d06b..8c7e51a6273cc 100644
--- a/scripts/kconfig/preprocess.c
+++ b/scripts/kconfig/preprocess.c
@@ -138,7 +138,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;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH AUTOSEL 4.19 06/11] kconfig: let 'shell' return enough output for deep path names
  2022-02-15 15:30 ` [PATCH AUTOSEL 4.19 06/11] kconfig: let 'shell' return enough output for deep path names Sasha Levin
@ 2022-02-20 10:01   ` Pavel Machek
  0 siblings, 0 replies; 2+ messages in thread
From: Pavel Machek @ 2022-02-20 10:01 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Brenda Streiff, Masahiro Yamada,
	linux-kbuild

[-- Attachment #1: Type: text/plain, Size: 855 bytes --]

Hi!

> [ Upstream commit 8a4c5b2a6d8ea079fa36034e8167de87ab6f8880 ]
> 
> 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.

If the idea is to support up-to PATH_MAX, perhaps open-coded 4096
should be replaced by PATH_MAX in the code, too?

Best regards,
								Pavel

> +++ b/scripts/kconfig/preprocess.c
> @@ -138,7 +138,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;

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-20 10:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20220215153104.581786-1-sashal@kernel.org>
2022-02-15 15:30 ` [PATCH AUTOSEL 4.19 06/11] kconfig: let 'shell' return enough output for deep path names Sasha Levin
2022-02-20 10:01   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).