Message ID | 20221114181055.214948-1-masahiroy@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2290918wru; Mon, 14 Nov 2022 10:17:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf4G/XUvc6HxaIdGG3pYfw373OabCAhhXby+PaLdlH/aGPFuJz3XcipNiKxNgDKvQAiUWhK3 X-Received: by 2002:a17:906:74cb:b0:78d:acf7:86a1 with SMTP id z11-20020a17090674cb00b0078dacf786a1mr11436990ejl.21.1668449827627; Mon, 14 Nov 2022 10:17:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668449827; cv=none; d=google.com; s=arc-20160816; b=l2ZZfZUJr7zvxmt2Pay1a/rilayv1/5aCUBQq+ipt+2EptXLvL4ueyVQCtcVDzUiFy 3c+4gpF347k9p3+YTpJBPAmNdpwBNzvo81PcaqKsjMRseaju39ku+0tnbsdjxDr5brIt uyYG+vrh9qklPf58+rg9hydoqnyfY+uKWXdh4o/j79lzhRo0cUctHw0EilyVF0VxD1dp kfhGZajQMV3Yms9LwggVcR96ViM10sDfWWM2Uv64MCzg/+eTbm18gewtJXsakrsr3KXp Rn1fjyUg7uDKG9p+UT8ZtKxkJIkCfyEN9zozmfg8GbjVm3L479+NdZYqwUiPFZD2vJ0f kfaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=4dzcih6HnUKdrTgLPPMlXbTbtVbZHA6IHrAGmyVgeQU=; b=xjYQTD/8fh3/IfHa4+IjqUTjXwVut0khLIkXoVidwZncAVDCo/BpHq6Bof270fgDLR T379bG3O+2QH3071uKbEyr50xBEGFnUDaNIe45cyvvAdhwxk7zXhfZ1zxJsjPkb3kPCZ 9v7l/9EQbi/5EZlKPvKXKm231ifk0jfTiB6L4zR5n03s9ZTxx3tkY9L/If/gR2UylmbG +9V3IwcZvi9ahLMPOB0lQAHy8YLHoRUkl1gd9VivJlSYctn/5QUlIEQmxH5rXY+ibMzK T95RcevO9aODbTOzrpuZ8dVuXlB6WBBuYFFEcl357WIeU3dt9k8UVmD30pMn+WJqmJGE vz1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNYkD3bE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sg40-20020a170907a42800b0078081036bdasi9068433ejc.501.2022.11.14.10.16.42; Mon, 14 Nov 2022 10:17:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tNYkD3bE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238158AbiKNSLe (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 14 Nov 2022 13:11:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236173AbiKNSL0 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 13:11:26 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16E75240A6; Mon, 14 Nov 2022 10:11:26 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 9E0CA6133B; Mon, 14 Nov 2022 18:11:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3062AC433C1; Mon, 14 Nov 2022 18:11:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668449485; bh=1O3d3xi2O06KTDEL1vSpCTxtSRQrEwJVWfeHpaw65G4=; h=From:To:Cc:Subject:Date:From; b=tNYkD3bEge7K6tj0u/fZO9pe+rGrKt4mYoy00W49CswaA8MfYhwkmrlIEa+I9WU3e njE4awseOvm3/o7ME1+KNvBXo4xwWNQqYhMk1z+BZhn0RLSOZKYVrfZkP4btxDq56B xx7wL32CIEQsKGwMFehuHbTX6edV7Yemdvtj7gLG+pQxW03DzUgwZd4gekNc0NEfWP m0SPhH6hJr9OlZJ+0u4qzf9bWqYO48zCqfazFNTPPYsMmj4obTxvkYSP61LEuevfjy Fk2AL8+Tn+IEG1I4tre+A2vWGpNu3mfAnxyJahXDT137LNThfMq4kWo7wq80/Bv8pc HoXijyjdgFnyQ== From: Masahiro Yamada <masahiroy@kernel.org> To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada <masahiroy@kernel.org>, linux-kernel@vger.kernel.org Subject: [PATCH] scripts/jobserver-exec: parse the last --jobserver-auth= option Date: Tue, 15 Nov 2022 03:10:55 +0900 Message-Id: <20221114181055.214948-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749496446188581974?= X-GMAIL-MSGID: =?utf-8?q?1749496446188581974?= |
Series |
scripts/jobserver-exec: parse the last --jobserver-auth= option
|
|
Commit Message
Masahiro Yamada
Nov. 14, 2022, 6:10 p.m. UTC
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(-)
Comments
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>
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
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.