delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/06/07/15:26:54

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=ENdjsIPpkIc6gkZD
dHlA21CF9fEBd72L54W+CNzQAZY8QUWmy6mn4RUreZdCB0RFvjkjMTuFMGF8Kjc5
H+NsC9+35xC4wZQVQA5aQtWfeO25hgCda/S0gAel9IFzjAdTj9nGn/PYgwvvpOJq
xdxSpUMi75GLyO6ozv7mwANQo4w=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=BbYbu1zJfA9swTedPdrjM6
f/LIM=; b=uV9LsTP+0Ko0LhmTs6sHcvu4loUptPmHK76yhvQlBCv2fwL+hzJRHW
vbTTWYpMhacDbEdERSy4KuDHWQZsdEdeVLYgpdKOZ1A0tHVqz9YGJc1GRi220a9h
z6znWybL97sx7i6/ygF07/u67027h4MRO8viMCtAp9NdOHwrnWcwo=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*r:sk:smtp-ou, brian, Brian, HContent-Language:en-CA
X-HELO: smtp-out-so.shaw.ca
X-Authority-Analysis: v=2.2 cv=UpATD64B c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=w_pzkKWiAAAA:8 a=FPHvfgn_2UWpPaSgVtwA:9 a=QEXdDO2ut3YA:10 a=PUBlrawA0xwA:10 a=sRI3_1zDfAgwuvI8zelB:22
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts
To: cygwin AT cygwin DOT com
References: <0F7D3B1B3C4B894D824F5B822E3E5A175B2636E4 AT IRSMSX103 DOT ger DOT corp DOT intel DOT com> <a53282b6-d00c-aad8-76a6-26b4089a9623 AT redhat DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Message-ID: <769304a2-efc7-0a33-4d94-1b608480bb2b@SystematicSw.ab.ca>
Date: Wed, 7 Jun 2017 13:26:35 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1
MIME-Version: 1.0
In-Reply-To: <a53282b6-d00c-aad8-76a6-26b4089a9623@redhat.com>
X-CMAE-Envelope: MS4wfNCoInX6tqwEi864KCWjscnTsN1q8VRP2UVFMc6lFdL12ATCuxYQ120GcSzHrj9rfLtdMroLL6R8LQfdTD/3+3J1Bir6YoqwEKhWskDbpMi2lEyOdasA dSIYPbczCsdUwrbEBmr6cgIafQOYojZqpo5N9NvKUkcs3/g4CzUIu/9pfUSbCe7pYnO2D9vx40s2Fg==
X-IsSubscribed: yes

On 2017-06-07 11:23, Eric Blake wrote:
> On 06/07/2017 11:23 AM, Soegtrop, Michael wrote:
>> 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 .)

For compatibility var=$( prog | sed -b -e 's/\r$//' ...)

>> 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.

Note that -b, --binary is not documented in any sed man page, only in
--help, and info pages (info -- sed -b), where it is explained as "This
option is available on every platform, but is only effective where the
operating system makes a distinction between text files and binary files".

On Cygwin that is now only files on text mounts; that also now applies
to many other Cygwin text utils: we have all had to make minor script
tweaks to deal with possible Windows text file input.

If you use sed -b -e 's/\r$//' where you currently use plain sed and
Windows text files may be input, it will work compatibly across platforms.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019