From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.9 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by dcvr.yhbt.net (Postfix) with ESMTP id 169681F452 for ; Wed, 5 Apr 2023 16:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229872AbjDEQz0 (ORCPT ); Wed, 5 Apr 2023 12:55:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233533AbjDEQzW (ORCPT ); Wed, 5 Apr 2023 12:55:22 -0400 Received: from cloud.peff.net (cloud.peff.net [104.130.231.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 744976196 for ; Wed, 5 Apr 2023 09:54:19 -0700 (PDT) Received: (qmail 4895 invoked by uid 109); 5 Apr 2023 16:54:18 -0000 Received: from Unknown (HELO peff.net) (10.0.1.2) by cloud.peff.net (qpsmtpd/0.94) with ESMTP; Wed, 05 Apr 2023 16:54:18 +0000 Authentication-Results: cloud.peff.net; auth=none Received: (qmail 12921 invoked by uid 111); 5 Apr 2023 16:54:14 -0000 Received: from coredump.intra.peff.net (HELO sigill.intra.peff.net) (10.0.0.2) by peff.net (qpsmtpd/0.94) with (TLS_AES_256_GCM_SHA384 encrypted) ESMTPS; Wed, 05 Apr 2023 12:54:14 -0400 Authentication-Results: peff.net; auth=none Date: Wed, 5 Apr 2023 12:54:14 -0400 From: Jeff King To: Patrick Steinhardt Cc: Todd Zullinger , git@vger.kernel.org Subject: Re: [PATCH] global: resolve Perl executable via PATH Message-ID: <20230405165414.GA497301@coredump.intra.peff.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Wed, Apr 05, 2023 at 04:52:40PM +0200, Patrick Steinhardt wrote: > > Is there a reason to not set PERL_PATH, which is the > > documented method to handle this? From the Makefike: > > > > # Define PERL_PATH to the path of your Perl binary (usually /usr/bin/perl). > > Setting PERL_PATH helps with a subset of invocations where the Makefile > either executes Perl directly or where it writes the shebang itself. But > the majority of scripts I'm touching have `#!/usr/bin/perl` as shebang, > and that path is not adjusted by setting PERL_PATH. Which scripts? If I do: mkdir /tmp/foo ln -s /usr/bin/perl /tmp/foo/my-perl make PERL_PATH=/tmp/foo/my-perl prefix=/tmp/foo install head -n 1 /tmp/foo/bin/git-cvsserver Then I see: #!/tmp/foo/my-perl And that is due to this segment in the Makefile: $(SCRIPT_PERL_GEN): % : %.perl GIT-PERL-DEFINES GIT-PERL-HEADER GIT-VERSION-FILE $(QUIET_GEN) \ sed -e '1{' \ -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \ -e ' r GIT-PERL-HEADER' \ -e ' G' \ -e '}' \ -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \ $< >$@+ && \ chmod +x $@+ && \ mv $@+ $@ And that behavior goes all the way back to bc6146d2abc ('build' scripts before installing., 2005-09-08). If there are some perl scripts we are "building" outside of this rule, then that is probably a bug. The only thing I found via: find /tmp/foo -type | xargs grep /usr/bin/perl was a sample hook (which is probably a bug; we do munge the hook scripts to replace @PERL_PATH@, etc, but I think the Makefile never learned that the template hook scripts might be something other than shell scripts). -Peff