linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] scripts/jobserver-exec: parse the last --jobserver-auth= option
@ 2022-11-14 18:10 Masahiro Yamada
  2022-11-14 21:10 ` Nicolas Schier
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2022-11-14 18:10 UTC (permalink / raw)
  To: linux-kbuild; +Cc: Masahiro Yamada, linux-kernel

In the GNU Make manual, the section "Sharing Job Slots with GNU make"
says:

    Be aware that the MAKEFLAGS variable may contain multiple instances
    of the --jobserver-auth= option. Only the last instance is relevant.

Take the last element of the array, not the first.

Link: https://www.gnu.org/software/make/manual/html_node/Job-Slots.html
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/jobserver-exec | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/scripts/jobserver-exec b/scripts/jobserver-exec
index 8762887a970c..4192855f5b8b 100755
--- a/scripts/jobserver-exec
+++ b/scripts/jobserver-exec
@@ -23,7 +23,9 @@ try:
 	opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]
 
 	# Parse out R,W file descriptor numbers and set them nonblocking.
-	fds = opts[0].split("=", 1)[1]
+	# If the MAKEFLAGS variable contains multiple instances of the
+	# --jobserver-auth= option, the last one is relevant.
+	fds = opts[-1].split("=", 1)[1]
 	reader, writer = [int(x) for x in fds.split(",", 1)]
 	# Open a private copy of reader to avoid setting nonblocking
 	# on an unexpecting process with the same reader fd.
-- 
2.34.1


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

* Re: [PATCH] scripts/jobserver-exec: parse the last --jobserver-auth= option
  2022-11-14 18:10 [PATCH] scripts/jobserver-exec: parse the last --jobserver-auth= option Masahiro Yamada
@ 2022-11-14 21:10 ` Nicolas Schier
  2022-11-15  1:42   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Schier @ 2022-11-14 21:10 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kbuild, linux-kernel

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

On Tue, Nov 15, 2022 at 03:10:55AM +0900, Masahiro Yamada wrote:
> In the GNU Make manual, the section "Sharing Job Slots with GNU make"
> says:
> 
>     Be aware that the MAKEFLAGS variable may contain multiple instances
>     of the --jobserver-auth= option. Only the last instance is relevant.
> 
> Take the last element of the array, not the first.
> 
> Link: https://www.gnu.org/software/make/manual/html_node/Job-Slots.html
> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> ---
> 
>  scripts/jobserver-exec | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/scripts/jobserver-exec b/scripts/jobserver-exec
> index 8762887a970c..4192855f5b8b 100755
> --- a/scripts/jobserver-exec
> +++ b/scripts/jobserver-exec
> @@ -23,7 +23,9 @@ try:
>  	opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]
>  
>  	# Parse out R,W file descriptor numbers and set them nonblocking.
> -	fds = opts[0].split("=", 1)[1]
> +	# If the MAKEFLAGS variable contains multiple instances of the
> +	# --jobserver-auth= option, the last one is relevant.
> +	fds = opts[-1].split("=", 1)[1]
>  	reader, writer = [int(x) for x in fds.split(",", 1)]
>  	# Open a private copy of reader to avoid setting nonblocking
>  	# on an unexpecting process with the same reader fd.
> -- 
> 2.34.1

I think it feels a bit odd to check for '--jobserver' (w/o '-auth'), but
"fixing" it would require depending on make >= 4.2 (May 2016).  That's probably
not yet old enough, isn't it?

Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH] scripts/jobserver-exec: parse the last --jobserver-auth= option
  2022-11-14 21:10 ` Nicolas Schier
@ 2022-11-15  1:42   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2022-11-15  1:42 UTC (permalink / raw)
  To: Nicolas Schier; +Cc: linux-kbuild, linux-kernel

On Tue, Nov 15, 2022 at 6:11 AM Nicolas Schier <nicolas@fjasle.eu> wrote:
>
> On Tue, Nov 15, 2022 at 03:10:55AM +0900, Masahiro Yamada wrote:
> > In the GNU Make manual, the section "Sharing Job Slots with GNU make"
> > says:
> >
> >     Be aware that the MAKEFLAGS variable may contain multiple instances
> >     of the --jobserver-auth= option. Only the last instance is relevant.
> >
> > Take the last element of the array, not the first.
> >
> > Link: https://www.gnu.org/software/make/manual/html_node/Job-Slots.html
> > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > ---
> >
> >  scripts/jobserver-exec | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/scripts/jobserver-exec b/scripts/jobserver-exec
> > index 8762887a970c..4192855f5b8b 100755
> > --- a/scripts/jobserver-exec
> > +++ b/scripts/jobserver-exec
> > @@ -23,7 +23,9 @@ try:
> >       opts = [x for x in flags.split(" ") if x.startswith("--jobserver")]
> >
> >       # Parse out R,W file descriptor numbers and set them nonblocking.
> > -     fds = opts[0].split("=", 1)[1]
> > +     # If the MAKEFLAGS variable contains multiple instances of the
> > +     # --jobserver-auth= option, the last one is relevant.
> > +     fds = opts[-1].split("=", 1)[1]
> >       reader, writer = [int(x) for x in fds.split(",", 1)]
> >       # Open a private copy of reader to avoid setting nonblocking
> >       # on an unexpecting process with the same reader fd.
> > --
> > 2.34.1
>
> I think it feels a bit odd to check for '--jobserver' (w/o '-auth'), but
> "fixing" it would require depending on make >= 4.2 (May 2016).  That's probably
> not yet old enough, isn't it?


Right. The option was --jobserver-fds= for Make <= 4.1.
I think requiring Make 4.2 is too early at this moment.






> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
>



--
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2022-11-15  1:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-14 18:10 [PATCH] scripts/jobserver-exec: parse the last --jobserver-auth= option Masahiro Yamada
2022-11-14 21:10 ` Nicolas Schier
2022-11-15  1:42   ` Masahiro Yamada

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).