delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2015/09/11/07:17:55

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:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
q=dns; s=default; b=yF7JSrDHgXiCvpFL4NiT4U+lD2IwqE9mgxLrRuVFEY/
elFmKb91oIrqyexQfi7QlKfPLlmuxYsY3tSAtH5FoWkMTMLjiEMGTHTqevQwtxGF
SntJZBZHmms4RRGdn522rQ2vN1QIbY4VAmOLTyKsAwdPD5bsMnJsPsNoBVk7nxbg
=
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:date:from:to:subject:message-id:in-reply-to
:references:mime-version:content-type:content-transfer-encoding;
s=default; bh=ookI46ULcu4KY/QAQvMi0Uou+W8=; b=Ie5OusW7idAL4piE/
CYY6R/SQNoI/g6f0SPF/quGg5OIcS+EueSR/Pf+nPJDitVowEV9L+9yyxF0FH5dU
jEy+uwhB/5Us+p8u+ptdBVTy3nReshjX0lKEJgIGB1vT96kqAilTBYH9jpEjAHw8
wQQR5+F0v8WzDFWuXFgA61BDxQ=
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=0.1 required=5.0 tests=BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: smtp35.i.mail.ru
Date: Fri, 11 Sep 2015 14:17:29 +0300
From: Mikhail Usenko <cygwin AT inbox DOT ru>
To: cygwin AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] Updated: bash-4.3.42-3
Message-Id: <20150911141729.0318b690929d91edcee250bd@inbox.ru>
In-Reply-To: <announce.55DCCDEA.6000208@redhat.com>
References: <announce DOT 55DCCDEA DOT 6000208 AT redhat DOT com>
Mime-Version: 1.0
X-IsSubscribed: yes

On Tue, 25 Aug 2015 14:19:54 -0600
Eric Blake (cygwin) <...> wrote:

> A new release of bash, 4.3.42-3, has been uploaded and will soon reach a
> mirror near you; leaving 4.3.39-2 as the previous version.
> 

It is one more buggy release (cygwin-specific).

---8<---(cygwin-test.sh)---8<---
#! /bin/bash

sender()
{
  echo -n  '\r\n' >&2
  echo -ne '\r\n'
  sleep 1
  echo -n  '\r\r\n' >&2
  echo -ne '\r\r\n'
  sleep 1
  echo -n  '\r\r\r\n' >&2
  echo -ne '\r\r\r\n'
  sleep 1
}

receiver()
{
  t=""
  while read t || [ "$t" ]; do
    echo -n ": "
    od -A n -t x1  <<<"$t"
  done  >&2
}

# implicit pipe
receiver < <(sender)

# explicit pipeline
sender | receiver

--->8---(cygwin-test.sh)--->8---

$ ./cygwin-test.sh
\r\n:  0a
\r\r\n:  0d 0d 0a
\r\r\r\n:  0d 0d 0a
\r\n:  0a
\r\r\n:  0d 0d 0a
\r\r\r\n:  0d 0d 0a

There is also the similar problem found accidentally just now with sed in pipelines:
$ echo -ne "\r\n" | sed '' | od -A n -tx1  # should be: 0d 0a
 0a
$ echo -ne "\r\r\n" | sed '' | od -A n -tx1  # should be: 0d 0d 0a
 0d 0a


On Thu, 04 Jun 2015 06:16:04 -0600
Eric Blake <...> wrote:

> 
> 'echo -ne' is non-portable (I can break it with 'shopt -s xpg_echo');
> get used to using 'printf' instead.
> 

xpg_echo doesn't change 'echo -ne' behavior
('echo -e' force backslash-escape sequences expansion independently)

$ shopt xpg_echo
xpg_echo        off
$ echo -e '\r\n' | od -tx1
0000000 0d 0a 0a
0000003
$ shopt -s xpg_echo
$ shopt xpg_echo
xpg_echo        on
$ echo -e '\r\n' | od -tx1
0000000 0d 0a 0a
0000003
$ echo '\r\n' | od -tx1
0000000 0d 0a 0a
0000003


-- 
Mike


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