{"thread":{"id":"49153","subject":"[RFC] git send-email hashbang","startedAt":"2018-08-17T13:14:11Z","lastAt":"2018-08-17T13:22:30Z","messageCount":2,"participants":["Samuel Maftoul","Ævar Arnfjörð Bjarmason"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"355901","messageId":"CAFj+z07x=X0_8Tdg6KsVwyRhcaUTGrSA2=t5W91m9b702A0xUA@mail.gmail.com","threadId":"49153","inReplyTo":null,"subject":"[RFC] git send-email hashbang","fromName":"Samuel Maftoul","fromEmail":"samuel.maftoul@gmail.com","sentAt":"2018-08-17T13:13:56Z","receivedAt":"2018-08-17T13:14:11Z","isPatch":false,"sender":{"key":"samuel.maftoul@gmail.com","avatar":"https://avatars.githubusercontent.com/u/239203?v=4"},"body":"I recently contributed for the first time patches on this maillist and\nused for the first time `git format-patch` and `git send-email`.\nI had hard times making `git send-email` work on my mac, because the\nOSX bundled perl was missing the Net::SMTP::SSL module.\nSo I did `cpan -f Net::SMTP::SSL` (I'm using gmail with smtps/ssl)\nwhich asked me some questions (to setup cpan, I'm not really using\nperl usually), and installed the module.\nStill `git send-email` wasn't able to find the module.\nActually, during the setup of cpan, I have been asked this:\n\n--------------------------\nWarning: You do not have write permission for Perl library directories.\n\nTo install modules, you need to configure a local Perl library directory or\nescalate your privileges.  CPAN can help you by bootstrapping the local::lib\nmodule or by configuring itself to use 'sudo' (if available).  You may also\nresolve this problem manually if you need to customize your setup.\n\nWhat approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')\n--------------------------\n\nI have naturally choosed the default ('local::lib'), but it still didn't worked.\n\nSo I choose to not use the system bundled perl and installed my own\nperl with homebrew, installed the Net::SMTP::SSL module ... but still\n, it didn't worked.\nI looked at the send-email script, changed the hashbang to use\n/usr/local/bin/perl instead of /usr/bin/perl and it worked !\n\nThen I wondered what happened, and I discovered that using the bundled\ncpan's \"sudo\" approach works, but I'm not very satisfied that I need\nto be root to make this script work.\nI also found several stackoverflow questions, gists and other\ndiscussiond with people having this exact problem (on osx) with some\ndifferent solution (mostly not working, using `sudo cpan` or\nwhatever).\n\nIt seems strange to me that the script doesn't uses \"the perl I use in\nmy environment\", that is, I would have thought the `git-send-email.pl`\nscript had `#!/usr/bin/env perl` as hashbang.\nThen, I read that some environment (namely busybox) don't bundle\n`/usr/bin/env`, so I understood this might not be portable.\nI think there is a solution involving using a combination of /bin/sh\nas hashbang and there executing perl with probably the `-x` flag (see\n`perldoc perlrun`).\nIs it worth proposing a solution for this problem ?\n\nThanks !\n"},{"id":"355903","messageId":"878t55qga6.fsf@evledraar.gmail.com","threadId":"49153","inReplyTo":"CAFj+z07x=X0_8Tdg6KsVwyRhcaUTGrSA2=t5W91m9b702A0xUA@mail.gmail.com","subject":"Re: [RFC] git send-email hashbang","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2018-08-17T13:22:25Z","receivedAt":"2018-08-17T13:22:30Z","isPatch":false,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"\nOn Fri, Aug 17 2018, Samuel Maftoul wrote:\n\n> I recently contributed for the first time patches on this maillist and\n> used for the first time `git format-patch` and `git send-email`.\n> I had hard times making `git send-email` work on my mac, because the\n> OSX bundled perl was missing the Net::SMTP::SSL module.\n> So I did `cpan -f Net::SMTP::SSL` (I'm using gmail with smtps/ssl)\n> which asked me some questions (to setup cpan, I'm not really using\n> perl usually), and installed the module.\n> Still `git send-email` wasn't able to find the module.\n> Actually, during the setup of cpan, I have been asked this:\n>\n> --------------------------\n> Warning: You do not have write permission for Perl library directories.\n>\n> To install modules, you need to configure a local Perl library directory or\n> escalate your privileges.  CPAN can help you by bootstrapping the local::lib\n> module or by configuring itself to use 'sudo' (if available).  You may also\n> resolve this problem manually if you need to customize your setup.\n>\n> What approach do you want?  (Choose 'local::lib', 'sudo' or 'manual')\n> --------------------------\n>\n> I have naturally choosed the default ('local::lib'), but it still didn't worked.\n>\n> So I choose to not use the system bundled perl and installed my own\n> perl with homebrew, installed the Net::SMTP::SSL module ... but still\n> , it didn't worked.\n> I looked at the send-email script, changed the hashbang to use\n> /usr/local/bin/perl instead of /usr/bin/perl and it worked !\n>\n> Then I wondered what happened, and I discovered that using the bundled\n> cpan's \"sudo\" approach works, but I'm not very satisfied that I need\n> to be root to make this script work.\n> I also found several stackoverflow questions, gists and other\n> discussiond with people having this exact problem (on osx) with some\n> different solution (mostly not working, using `sudo cpan` or\n> whatever).\n\nYeah this experience sucks.\n\n> It seems strange to me that the script doesn't uses \"the perl I use in\n> my environment\", that is, I would have thought the `git-send-email.pl`\n> script had `#!/usr/bin/env perl` as hashbang.\n> Then, I read that some environment (namely busybox) don't bundle\n> `/usr/bin/env`, so I understood this might not be portable.\n> I think there is a solution involving using a combination of /bin/sh\n> as hashbang and there executing perl with probably the `-x` flag (see\n> `perldoc perlrun`).\n> Is it worth proposing a solution for this problem ?\n\nThe reason not to use the \"perl\" in the env is because you just get the\nother side of this problem. I.e. I install \"git\" on some linux distro,\nbut I also do perl development so I install a perlbrew version of it\ninto my ~/ which doesn't know how to do ssl or whatever else.\n\nNow send-email, \"git add -p\" and the like will break because the perl I\nhave doesn't have the required modules etc.\n\nThis is why we pick a perl at compile-time, just as we link to libraries\netc. at compile-time.\n\nBut perhaps this trade-off isn't the right one to make on OSX.\n"}]}