Re: [RFC] git send-email hashbang
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Aug 17, 2018, 13:22 UTC
- Message-ID
- <878t55qga6.fsf@evledraar.gmail.com>
- In-Reply-To
- <CAFj+z07x=X0_8Tdg6KsVwyRhcaUTGrSA2=t5W91m9b702A0xUA@mail.gmail.com>
On Fri, Aug 17 2018, Samuel Maftoul wrote:
Show 36 quoted lines
> I recently contributed for the first time patches on this maillist and
> used for the first time `git format-patch` and `git send-email`.
> I had hard times making `git send-email` work on my mac, because the
> OSX bundled perl was missing the Net::SMTP::SSL module.
> So I did `cpan -f Net::SMTP::SSL` (I'm using gmail with smtps/ssl)
> which asked me some questions (to setup cpan, I'm not really using
> perl usually), and installed the module.
> Still `git send-email` wasn't able to find the module.
> Actually, during the setup of cpan, I have been asked this:
>
> --------------------------
> Warning: You do not have write permission for Perl library directories.
>
> To install modules, you need to configure a local Perl library directory or
> escalate your privileges. CPAN can help you by bootstrapping the local::lib
> module or by configuring itself to use 'sudo' (if available). You may also
> resolve this problem manually if you need to customize your setup.
>
> What approach do you want? (Choose 'local::lib', 'sudo' or 'manual')
> --------------------------
>
> I have naturally choosed the default ('local::lib'), but it still didn't worked.
>
> So I choose to not use the system bundled perl and installed my own
> perl with homebrew, installed the Net::SMTP::SSL module ... but still
> , it didn't worked.
> I looked at the send-email script, changed the hashbang to use
> /usr/local/bin/perl instead of /usr/bin/perl and it worked !
>
> Then I wondered what happened, and I discovered that using the bundled
> cpan's "sudo" approach works, but I'm not very satisfied that I need
> to be root to make this script work.
> I also found several stackoverflow questions, gists and other
> discussiond with people having this exact problem (on osx) with some
> different solution (mostly not working, using `sudo cpan` or
> whatever).Yeah this experience sucks.
Show 9 quoted lines
> It seems strange to me that the script doesn't uses "the perl I use in > my environment", that is, I would have thought the `git-send-email.pl` > script had `#!/usr/bin/env perl` as hashbang. > Then, I read that some environment (namely busybox) don't bundle > `/usr/bin/env`, so I understood this might not be portable. > I think there is a solution involving using a combination of /bin/sh > as hashbang and there executing perl with probably the `-x` flag (see > `perldoc perlrun`). > Is it worth proposing a solution for this problem ?
The reason not to use the "perl" in the env is because you just get the other side of this problem. I.e. I install "git" on some linux distro, but I also do perl development so I install a perlbrew version of it into my ~/ which doesn't know how to do ssl or whatever else.
Now send-email, "git add -p" and the like will break because the perl I have doesn't have the required modules etc.
This is why we pick a perl at compile-time, just as we link to libraries etc. at compile-time.
But perhaps this trade-off isn't the right one to make on OSX.