public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com
Subject: Re: bash: igncr shell option breaks my PS1 prompt
Date: Fri, 02 Sep 2016 13:32:00 -0000	[thread overview]
Message-ID: <a3b97bcb-d880-23b3-3acb-e68276509bde@redhat.com> (raw)
In-Reply-To: <CAPTiy3Ow6b6n7Nfd+DHpfnw-W7Y_ZAXS4+CqQaX8BzsV=hhkow@mail.gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 1708 bytes --]

On 09/02/2016 06:52 AM, Gene Pavlovsky wrote:
> Dear Eric Blake,
> 
> I understand there were issues with read handling of \r. But is the
> resulting solution/bugfix ideal?

Yes.  The recent change to 'read' was a bugfix, and as far as I'm
concerned, it is the ideal fix (you get binary behavior by default, and
text behavior if you use igncr; just as with every other aspect of the
shell controlled by igncr).

> Or does it introduce new problems?

No. The existing problem of igncr vs. PS1 was pre-existing, it was NOT
introduced by the recent change to 'read'.

> 
> Basically, I don't want to set `igncr` as system-wide shell option
> (e.g. through SHELLOPTS).

Don't use it, then.  I highly recommend avoiding 'igncr', because it
exists only as a crutch.  The real solution is to fix your environment
to be binary-clean, at which point you no longer need igncr. But I also
understand that fixing an environment to be binary-clean can be
expensive, so 'igncr' remains as the crutch.

> So, how do I keep an existing bash script, that uses `read` piped from
> the output of a Windows console program that uses CRLF as newlines,
> working, without modifying the script? I don't see how it's possible
> with the current situation.

By piping the output of the Windows program through d2u before handing
it to 'read'.

> 
> Personally I think that by default read should behave as it did for
> years.

Sorry, but I am NOT a fan of default behavior that corrupts my data.  I
am not going to maintain backwards bug compatibility to the broken read
behavior.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-09-02 13:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-27 16:20 Gene Pavlovsky
2016-08-27 18:31 ` Andrey Repin
2016-08-29  5:18 ` Gene Pavlovsky
2016-08-30  2:21   ` Eric Blake
2016-08-30  7:49     ` Andrey Repin
2016-08-30 16:57       ` Nellis, Kenneth
2016-08-30 17:38         ` Houder
2016-08-30 13:16     ` Houder
2016-08-30 17:04       ` Eric Blake
2016-08-30 20:50         ` Houder
2016-09-02 11:52         ` Gene Pavlovsky
2016-09-02 13:32           ` Eric Blake [this message]
2016-09-04  9:11             ` Gene Pavlovsky

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a3b97bcb-d880-23b3-3acb-e68276509bde@redhat.com \
    --to=eblake@redhat.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).