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

Re: t0025 weird behaviour on NonStop ksh/bash

From
Junio C Hamano <gitster@pobox.com>
Date
May 9, 2015, 02:50 UTC
Message-ID
<xmqqbnhuihv9.fsf@gitster.dls.corp.google.com>
In-Reply-To
<003101d089e5$27347610$759d6230$@nexbridge.com>
"Randall S. Becker" <rsbecker@nexbridge.com> writes:
Show 17 quoted lines
> Ok, I'm sure that this is not a git problem, but there is an assumption
> about echo behaviour in t0025 that may not be correct. When executed from a
> shell function on the HP NonStop platform under ksh and bash, the LFonly
> file annoyingly contains cr-lf not just lf. This causes sub-test 4 to fail.
> Weirdly, this does not happen from an interactive shell. My proposed
> solution, in t0025-crlf-auto.sh, to this is to make it explicit that bad
> behaviour on the part of echo should be dealt with severely, as in:
>
>         for w in Hello world how are you; do echo $w; done | tr -d '\r'
>>LFonly
>
> instead of 
>
>         for w in Hello world how are you; do echo $w; done >LFonly
>
> which is a no-op on platforms that behave themselves in this situation. Is
> this the proper approach?

Why on earth does "echo $w" that prints just ASCII alphabet and nothing else (other than the end-of-line, of course) gives CRLF in the first place?

Is stripping with "tr -d" a sane approach? I am not sure if it is tackling the right problem.

Because we use 'echo', expecting it to behave sensibly in many other places, wouldn't it be the case that all your 'tr -d' here does is to add an unnecessary pipe on sane platforms for this single test script, while leaving all the other uses of 'echo' in other shell scripts, including scripted Porcelains like 'git pull', broken on your platform?

Previous: Randall S. BeckerNext: Randall S. Becker
Message 2 of 3 in “t0025 weird behaviour on NonStop ksh/bash”
  1. Randall S. BeckerMay 8, 2015
  2. Junio C HamanoMay 9, 2015
  3. Randall S. BeckerMay 9, 2015

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.