git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] t: Replace 'perl' by $PERL_PATH

From
Erik Faye-Lund <kusmabite@gmail.com>
Date
Jun 12, 2012, 15:36 UTC
Message-ID
<CABPQNSY=X8HG__vcEncdcgjT4fvqaC1gX_5_QH4n0+bX0tNT6g@mail.gmail.com>
In-Reply-To
<7v1ull7j9k.fsf@alter.siamese.dyndns.org>
On Mon, Jun 11, 2012 at 9:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 27 quoted lines
> vfr@lyx.org writes:
>
>> From: Vincent van Ravesteijn <vfr@lyx.org>
>>
>> GIT-BUILD-OPTIONS defines PERL_PATH to be used in the test suite. Only a
>> few tests already actually use this variable when perl is needed. The
>> other test just call 'perl' and it might happen that the wrong perl
>> interpreter is used.
>>
>> This becomes problematic on Windows, when the perl interpreter that is
>> compiled and installed on the Windows system is used, because this perl
>> interpreter might introduce some unexpected LF->CRLF conversions.
>>
>> This patch makes sure that $PERL_PATH is used everywhere in the test suite
>> and that the correct perl interpreter is used.
>>
>> Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
>> ---
>
> There was already this discussion:
>
>    http://thread.gmane.org/gmane.comp.version-control.git/132560/focus=132561
>
> which basically dismissed effort along this line with "If the perl
> in your PATH is so broken that it can't be used for simple helpers,
> then you should fix your PATH."
>

This way of looking at it has the flaw that it might not be the Perl that is "broken", it could be that Git is the guilty one for creating problems.

The reason in this case is that pipes are text-mode by default, which means newlines get translated between LF and CRLF on Windows. However, Git is largely written for Unixy systems where there's no CRLF-translation going on.

Because a lot of the internal Git protocols assume they can send binary data over stdin/stdout by default, we set these to binary mode on startup in Git for Windows to avoid. This cause problems with external tools like Perl, but we currently ship an MSYS version of perl where text-mode means LF-newlines, and thus no translation.

Having an MSYS version of Perl in PATH is "broken" in the Windows world, so it's THIS Perl that people might want to keep out of their PATH.

That being said, it should be possible (and probably desirable) to have a different PATH for the MSYS environment. But I'm not sure how well this works for people who run Git for Windows from cmd, as opposed to from MSYS.

In the long run, it would probably be better to default to text-mode, and explicitly switch between text and binary-mode when needed. But for now, the binary-pipe-hack "almost works" ;)

Previous: Jeff KingNext: Junio C Hamano
Message 6 of 15 in “t: Replace 'perl' by $PERL_PATH”
  1. t: Replace 'perl' by $PERL_PATHvfr@lyx.org, Jun 11, 2012
  2. Junio C HamanoJun 11, 2012
  3. Jeff KingJun 12, 2012
  4. Junio C HamanoJun 12, 2012
  5. Jeff KingJun 12, 2012
  6. Erik Faye-LundJun 12, 2012
  7. Junio C HamanoJun 12, 2012
  8. Junio C HamanoJun 12, 2012
  9. Jeff KingJun 12, 2012
  10. Vincent van RavesteijnJun 12, 2012
  11. Torsten BögershausenJun 17, 2012
  12. Junio C HamanoJun 17, 2012
  13. Torsten BögershausenJun 17, 2012
  14. Junio C HamanoJun 17, 2012
  15. Torsten BögershausenJun 20, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.