git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "brian m. carlson" <sandals@crustytoothpaste.net>
Cc: John Passaro <john.a.passaro@gmail.com>, git@vger.kernel.org
Subject: Re: Can git choose perl at runtime?
Date: Sun, 23 Dec 2018 23:05:46 +0100	[thread overview]
Message-ID: <87y38few5h.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <20181221234231.GB10611@genre.crustytoothpaste.net>


On Fri, Dec 21 2018, brian m. carlson wrote:

> On Tue, Dec 18, 2018 at 10:09:14PM -0500, John Passaro wrote:
>> I recently submitted my first patch using OSX and found the experience
>> frustrating, for reasons that have come up on the list before,
>> concerning git-send-email and perl dependencies that you need to be
>> root to update.
>>
>> Last seen here:
>> https://public-inbox.org/git/878t55qga6.fsf@evledraar.gmail.com/
>>
>> The struggle is that Mac's package manager Homebrew has opted,
>> apparently with some finality, to no longer support linking to a user
>> perl at build time. PERL_PATH is hard-coded to link to the system
>> perl, which means the user needs sudo to install the SSL libraries
>> required for send-email. So for send-email to work, you need to either
>> sudo cpan or build git yourself. The obvious solution here would be to
>> do /usr/bin/env perl, but in the above message Aevar pointed out
>> pitfalls with that.
>>
>> It seems that choosing perl at compile time necessarily comes with
>> tradeoffs. So I wonder if there is a way we can support choosing a
>> perl at runtime without breaking the existing mechanism of linking to
>> perl at compile time.
>>
>> I'm picturing adding an executable "git-perl" to libexec that checks
>> config core.perlPath and envvar GIT_PERL_PATH, in some order. Having
>> chosen one of these or the build-time PERL_PATH as a last resort, it
>> exec's the correct perl executable.
>>
>> Then relevant scripts (e.g. git-add--interactive, git-send-email)
>> invoke git-perl instead of /usr/bin/perl, and the makefile no longer
>> replaces that with PERL_PATH -- instead that will be used at runtime
>> via git-perl when we can be sure the user does not explicitly prefer
>> something different.
>
> How do git send-email and git svn work in such a case? They depend on
> the Git and Git::SVN modules being in place, so if you use a Perl other
> than the one you built Git with, they won't be present (or they'll be
> present, but potentially with the wrong version).

Yeah this is one of the things I was alluding to in
<87a7l1fx8x.fsf@evledraar.gmail.com>.

We don't ship any C bindings, so our libs end up in
e.g. /usr/share/perl5, some custom-built perls will have that in their
@INC still, no idea if any of this OSX stuff does.

But otherwise we'd either need to give the user a way to override
PERL5LIB (or they can do it themselves...), or better yet continue what
I started in 20d2a30f8f ("Makefile: replace perl/Makefile.PL with simple
make rules", 2017-12-10) and make our perl stuff entirely decoupled from
the system install.

E.g. Linux distros would probably still override that and install our
*.pm stuff in their usual Perl places, but by default we could just have
a libexec/perl directory with all this stuff, and find our libraries
there, then it won't matter if we chainload to a new Perl interpreter,
we'll still find the libs in the same place.

We could also turn RUNTIME_PREFIX on by default, it already fixes this
by proxy.

  reply	other threads:[~2018-12-23 22:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-19  3:09 Can git choose perl at runtime? John Passaro
2018-12-19  3:17 ` Jonathan Nieder
2018-12-19  6:33 ` Carlo Arenas
2018-12-19 13:53   ` Ævar Arnfjörð Bjarmason
2018-12-19 13:43 ` Ævar Arnfjörð Bjarmason
2018-12-21 23:42 ` brian m. carlson
2018-12-23 22:05   ` Ævar Arnfjörð Bjarmason [this message]
2018-12-23 23:18     ` brian m. carlson
2018-12-23 23:34       ` Ævar Arnfjörð Bjarmason
2018-12-24  2:20         ` brian m. carlson
2018-12-28 15:38           ` John Passaro

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y38few5h.fsf@evledraar.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=john.a.passaro@gmail.com \
    --cc=sandals@crustytoothpaste.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).