public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: cygwin@cygwin.com
Subject: Re: [Bug] bash' read builtin command behaves differently on '\r' (4.3.33)
Date: Thu, 14 May 2015 22:23:00 -0000	[thread overview]
Message-ID: <55550B73.6030802@redhat.com> (raw)
In-Reply-To: <20150514231823.5ce367d86ab4dd57d8ba024e@inbox.ru>

[-- Attachment #1: Type: text/plain, Size: 865 bytes --]

On 05/14/2015 02:18 PM, Mikhail Usenko wrote:
> Also when a bash script is launched from an external program
> with connected stdio from/to the program using a UNIX domain
> socket generated by socketpair() the read builtin works OK.

Thanks for the additional information. I can indeed duplicate that bash
is stripping \r\n to \n, but NOT stripping other \r, when reading from a
pipe:

$ printf ':\r:\r\n' | { read t; echo "-$t-"; } | od -tx1
0000000 2d 3a 0d 3a 2d 0a
0000006

and pipes themselves are not doing the stripping:

$ printf ':\r:\r\n' | od -tx1
0000000 3a 0d 3a 0d 0a
0000005

I also confirmed that raw files have the same problem.  Possibly a bug I
introduced in my code to support igncr, so I'll try to root it out.

-- 
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:[~2015-05-14 20:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14 19:52 Mikhail Usenko
2015-05-14 20:00 ` Eric Blake
2015-05-14 20:18   ` Mikhail Usenko
2015-05-14 20:54   ` Mikhail Usenko
2015-05-14 22:23     ` Eric Blake [this message]
2015-09-24 16:55 ` Eric Blake

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=55550B73.6030802@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).