bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: hello-2.1.91 and CR/LF


From: Ralf Wildenhues
Subject: Re: hello-2.1.91 and CR/LF
Date: Tue, 29 Aug 2006 20:37:53 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

Hello Karl,

* Karl Berry wrote on Mon, Aug 28, 2006 at 08:31:37PM CEST:
>     > However, on MinGW all three tests fail because the program outputs CRLF
>     > line endings, while the test suite creates files with LF ending.
> 
> Um, why?  That is, why does cat>foo produce LF files while hello>foo
> produces CRLF files?

I think with MSYS the situation is this: cat operates in binary mode,
thus does not change the data it is given.  The here-document created
by the shell has LF, as your test script has LF endings.  hello OTOH
creates text mode output, thus CRLF.

> Is this different in MinGW than under Cygwin?

Yes.  (Even if it is not officially different at the moment, and even if
I simply don't know the exact MSYS semantics: Cygwin has changed some
details in the not so distant past, were they bugfixes or intentional
semantic changes; so by all means one cannot assume they are equal.)

> (I'm probably just dumb,
> but I cannot infer this behavior from
> http://www.cygwin.com/cygwin-ug-net/using-textbinary.html.)

I find the Cygwin rules very complicated and incomprehensible in theory
and in real-world usage (where you usually have more than one tool
interacting).  But that may be just me.

> Can we easily get cat>foo (or some equivalent) to produce CRLF files?

You could use
  printf '%s\r\n' "$line"

or similar, but it would not save you from special-casing, I guess.

> That seems like it would be a tiny bit cleaner to me than deleting the
> \r from the hello>foo output.

You could just grep for interesting output; that's what I prefer.

Cheers,
Ralf




reply via email to

[Prev in Thread] Current Thread [Next in Thread]