Web lists-archives.com

Re: CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts




On 06/07/2017 11:23 AM, Soegtrop, Michael wrote:
> Dear Cygwin Team,
> 
> in the latest version of cygwin with sed-4.4-1.tar.bz2 the behavior of sed regarding handling CR-LF sequences changed.

And the change was documented (don't you read the release notes?)
https://cygwin.com/ml/cygwin-announce/2017-02/msg00036.html

> I would say that the documented behavior in both versions is that they replace CR-LF with LF,

No, the documented behavior is that CR-LF is converted to LF only for
text-mounted files; but pipelines are default binary-mounted.  If you
want to strip CR from a pipeline, then make it explicit.

> var=$( prog | sed .)

Rewrite that to var=$( prog | tr -d '\r' | sed .)

> Is this considered a bug in sed 4.4-1 or is the old behavior and the -b option considered deprecated and it was just forgotten to remove the documentation for the -b option?

The -b option still works (forcing binary mode when you otherwise have a
text mount); what changed was that the default behavior of pipelines is
now binary instead of text, as binary is a better default mode for Linux
compatibility.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature