Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5953084rwb; Tue, 1 Aug 2023 10:04:57 -0700 (PDT) X-Google-Smtp-Source: APBJJlEeYBSC8PVJcessy0tIY6DbqW20/7ti/iOSRWFD0/P8YVJMW6AUahtzhU4K6T/iKf/zE9kN X-Received: by 2002:a05:6402:270f:b0:522:582f:91af with SMTP id y15-20020a056402270f00b00522582f91afmr3885235edd.9.1690909497670; Tue, 01 Aug 2023 10:04:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690909497; cv=none; d=google.com; s=arc-20160816; b=iopK+V+1lUBq1X/+XCIJ9Az2dk+NzFUxV7y1GXbaPGIr23uDz5K3CXpkFgp9A1o0xY PoxtXvR257jy/CUP/anZSoZK4svL4coo2T88NkGnzINDWKwwBrczrrtAGzaUZHB7z91q iHJEGKE3xqZ56tRlxZK9u51G6yBsR1Vi/4oqv5LFAULVOj5mLXmJiGrWMjSmou8KgP0V H1QazojmFdBhp1kfqTMg1o1KGxxwlQQHxahvbtnrYa3IO2khm4BxVB7i8V4lOjfUp18/ fb/L+BsXJ8vq/EzUOzBNHPj5vJYkEmVX2EQLW3wsyegVnbcALLi8rhHy0vL7dkMl4coD eSJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/8aGypJFT0ZhAOvnckEVolE/elMCKeRLaO548mfPlWw=; fh=dMNCMksimw7wAld9W0lInj22ZStypnwtaWBH2ig850Y=; b=fI9Su2Gu3un1yOiXdIUf3c+OwmlR/N4Oe+iCmkGPUzS8XxEMt9NM65GLnoTyXxs77x Kp2HPCqS+tLNezP2BkqPF9UiwGwOdmn2Wc2u7YEvicB5h/4DIQwcyqhhgwoyPqYlGDck o36lx9fWXIeym0qFH6rCLfTDDEFMoMdJyiB7rCijO+pMpHcxyMB6jGq6CFSp1WdytROF h8mftelGwilvrvFlJW9UX2J9c7HEB5B9mPtxtJ0cbJ8nqL+AOHQoiQfc93BkBmRnOALc 7+VTL1XKdLDwFO7D6ggzHBaPXHblYXyPIY6IeWX2p/1RBQmtsi7VA+NT/mSuSTyVMmmI 4P2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XJz5VwLP; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f8-20020a50ee88000000b005222ae088b1si8845376edr.271.2023.08.01.10.04.01; Tue, 01 Aug 2023 10:04:57 -0700 (PDT) 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=XJz5VwLP; 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 S232495AbjHAQwH (ORCPT + 99 others); Tue, 1 Aug 2023 12:52:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232424AbjHAQwG (ORCPT ); Tue, 1 Aug 2023 12:52:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1C2042113; Tue, 1 Aug 2023 09:52:05 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AE77D61638; Tue, 1 Aug 2023 16:52:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BBB68C433C8; Tue, 1 Aug 2023 16:52:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690908724; bh=MFkD5hoSeTRMx7Qp0kqltdc9Uv7HMX81B55JxcvZjm8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XJz5VwLPIHHf1Q9fef4I0+jd42e3S4ZCpCf3EKXvDh90552lRLgaOmImAEvtexh1k UEiGDiZ4y/RY4W9QNNdwJ73LdG9gPCtl1iov89R7+o7vsI9Np6GqHuAuuy9YeEfevX yFDGK1PP+c4mMGnGtUUosH2eS686VfJZ3RHpEB2uz/aDlCoE2zCur42Dq2e/VEvk1c sRD4cRRkyeV4L1jiWEfRtXl7cKRE1UYi3HNQnV2kHbpHyyflC5zhl6jVf9AzYoWU1o XzFynMtIuBWXr/tvf8koqMzDwSTKRU1xKu92Y+sX1iibSuC5kcS07Qy+S+6FvOyCh8 s3VGdZ9YPloiw== Date: Tue, 1 Aug 2023 09:52:02 -0700 From: Nathan Chancellor To: Masahiro Yamada Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, Ben Hutchings , Nick Desaulniers , Nicolas Schier Subject: Re: [PATCH v2 1/2] kbuild: deb-pkg: use Debian compliant shebang for debian/rules Message-ID: <20230801165202.GA2472327@dev-arch.thelio-3990X> References: <20230801121926.1677205-1-masahiroy@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230801121926.1677205-1-masahiroy@kernel.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 01, 2023 at 09:19:25PM +0900, Masahiro Yamada wrote: > Debian Policy "4.9. Main building script: debian/rules" requires > "debian/rules must start with the line #!/usr/bin/make -f". [1] > > Currently, Kbuild does not follow this policy. > > When Kbuild generates debian/rules, "#!$(command -v $MAKE) -f" is > expanded by shell. The resuling string may not be "#!/usr/bin/make -f". > > There was a reason to opt out the Debian policy. > > If you run '/path/to/my/custom/make deb-pkg', debian/rules must also be > invoked by the same Make program. If #!/usr/bin/make were hard-coded in > debian/rules, the sub-make would be executed by a possibly different > Make version. > > This is problematic due to the MAKEFLAGS incompatibility, especially the > job server flag. Old Make versions used --jobserver-fds to propagate job > server file descriptors, but Make >= 4.2 uses --jobserver-auth. The flag > disagreement between the parent/child Makes would result in a process > fork explosion. > > However, having a non-standard path in the shebang causes another issue; > the generated source package is not portable as such a path does not > exist in other build environments. > > This commit solves those conflicting demands. > > Hard-code '#!/usr/bin/make -f' in debian/rules to create a portable and > Debian-compliant source package. > > Pass '--rules-file=$(MAKE) -f debian/rules' when dpkg-buildpackage is > invoked from Makefile so that debian/rules is executed by the same Make > program as used to start Kbuild. > > [1] https://www.debian.org/doc/debian-policy/ch-source.html#main-building-script-debian-rules > > Signed-off-by: Masahiro Yamada Tested-by: Nathan Chancellor > --- > > (no changes since v1) > > scripts/Makefile.package | 2 +- > scripts/package/mkdebian | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/Makefile.package b/scripts/Makefile.package > index 85beab0363d7..f8a948ec2c6b 100644 > --- a/scripts/Makefile.package > +++ b/scripts/Makefile.package > @@ -148,7 +148,7 @@ deb-pkg srcdeb-pkg bindeb-pkg: > $(if $(findstring source, $(build-type)), \ > --unsigned-source --compression=$(KDEB_SOURCE_COMPRESS)) \ > $(if $(findstring binary, $(build-type)), \ > - -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch), \ > + --rules-file='$(MAKE) -f debian/rules' -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch), \ > --no-check-builddeps) \ > $(DPKG_FLAGS)) > > diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian > index 9105abab9728..2829f5b8aea6 100755 > --- a/scripts/package/mkdebian > +++ b/scripts/package/mkdebian > @@ -264,7 +264,7 @@ EOF > fi > > cat < debian/rules > -#!$(command -v $MAKE) -f > +#!/usr/bin/make -f > > srctree ?= . > KERNELRELEASE = ${KERNELRELEASE} > -- > 2.39.2 >