delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2016/08/27/12:35:33

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:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; q=dns; s=default; b=wTwu5CUYYS4k1WKz
OQ7eC2F1e15Z3C5N5xk+aSIT59MJAAKJzPv1pxw5TSzlriDdAtEnQ23g1jiLcB/3
FkyRTX7uhYQ4nOTzEOjbeYh05ZVu3V4Fc4sMF6ICqc/hHtjPtdT2g4nybPvkckGD
svXTuP6ziVfeT5NGi4sPpZW/0Ac=
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:reply-to:message-id:to:subject
:in-reply-to:references:mime-version:content-type
:content-transfer-encoding; s=default; bh=Z57yE5Ms9wLDIFxrrFTEeZ
Dy8C0=; b=W7aa6rJjcWs3//IXrAgzkz9Q9X4IaCFKH7H51/kosd9HobcZkQ32hS
FOu1g7V2AwszS4GjcCNJ/ewEi5KLdcBZE3G/CiONpqNWaOPa1s73kF4gGBsGgaTu
zb8jJ/EORfHZrZUYXnPNJ6skgWrbuI0JauUOmXmOTI+J9CMayAxoo=
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.3 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,KAM_THEBAT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 spammy=H*F:D*yandex.ru, yandexru, UD:yandex.ru, yandex.ru
X-HELO: forward1j.cmail.yandex.net
Authentication-Results: smtp3o.mail.yandex.net; dkim=pass header.i=@yandex.ru
X-Yandex-Suid-Status: 1 0,1 0
Date: Sat, 27 Aug 2016 19:26:54 +0300
From: Andrey Repin <anrdaemon AT yandex DOT ru>
Reply-To: cygwin AT cygwin DOT com
Message-ID: <1793486.20160827192654@yandex.ru>
To: Gene Pavlovsky <gene DOT pavlovsky AT gmail DOT com>, cygwin AT cygwin DOT com
Subject: Re: bash: igncr shell option breaks my PS1 prompt
In-Reply-To: <CAPTiy3PE0gZ-hpvQbxVkfaZfxtppDx7RG85WtuigpnL54WZbDA@mail.gmail.com>
References: <CAPTiy3PE0gZ-hpvQbxVkfaZfxtppDx7RG85WtuigpnL54WZbDA AT mail DOT gmail DOT com>
MIME-Version: 1.0
X-IsSubscribed: yes

Greetings, Gene Pavlovsky!

> # PS1='\e[1;30m\D{%T}\e[m$(test \j -ne 0 && echo "\e[1;37mj:\j\e[m")${STY:+ \e[1;32m${STY%%.*}\e[m} \e[1;33m\w\e[m\n# '
> 14:32:22 /usr/local/bin
> # set -o igncr
> bash: command substitution: line 1: syntax error near unexpected token `)'
> bash: command substitution: line 1: `test 0 -ne 0 && echo " j:0")'
> 14:32:24{STY:+ } /usr/local/bin
> # set +o igncr
> 14:32:26 /usr/local/bin
> #

> What's wrong with this? It works fine on a Linux box.

Try using printf instead of echo, and explicitly quote any dubious characters.

> I'm considering rolling back bash until I can figure this out.

> I really think it was an unwise move to hastily modify the `read` bash
> built-in's behavior without a lot of testing. And basically now I
> should either put Cygwin-specific checks (if cygwin, then set igncr
> shell option) in all of my scripts that *might* be affected, or be
> forced to set igncr shell option system-wide, which I'd prefer not to
> do.

I don't understand, WHY it was modified, if at all.
But did you check the other side of your issue? Does the tool you read from
prints CRLF EOL? And if it is ONLY CRLF, and not CRCRLF, like some silly
things do.

> Can't imagine I'm the only guy whose scripts might be getting weird
> problems now. Unless everybody been using `igncr` shell option (off by
> default) for ages, and I'm the only guy who just heard about that?

Everybody not using CR's for ages to begin with.

> Personally I don't like the `igncr` option's behavior. I want my bash
> scripts to fail if somebody saved (or checked out from git) with CRLF
> line endings. If it happens, I will notice immediately and then fix
> them. Don't want to have bash scripts with CRLF line endings lurking
> on my system, pretending to be nice - then one day I'll copy one to my
> Linux box where it will break, surprising me more than when I first
> created it or checked out from git.

Again, I feel like your analysis is lacking and/or you are mixing things.


-- 
With best regards,
Andrey Repin
Saturday, August 27, 2016 19:16:33

Sorry for my terrible english...


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