[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#26832: bug on grep 3.0

From: Eric Blake
Subject: bug#26832: bug on grep 3.0
Date: Thu, 11 May 2017 13:06:58 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.0

On 05/10/2017 12:38 PM, Eric Blake wrote:
>> BTW, I realized follows.
>> Incorrect outputs of grep are output only on command prompt of Windows.
>> Correct results are output on console of cygwin.
> Then this is an issue in how cygwin programs handle their arguments when
> invoked from a native windows program, and/or a factor of the (weird)
> quoting rules in use by the Windows native command shell (which are NOT
> AT ALL like normal POSIX shell quoting rules), and nothing to do with
> upstream grep. You'll probably have better results posting your question
> on the cygwin mailing list.

In fact, the cygwin list pointed out that the change was intentional -
when you are using the builtin 'echo' of a Windows command prompt, you
are feeding CRLF data into grep, but the cygwin build of grep no longer
forcefully treats binary files in text mode, which means the pattern
"/$" no longer matches on the input string "/\r\n", but only on "/\n".
When you use a Cygwin shell, the builtin 'echo' does not produce \r in
the first place.

shows that the change was coordinated between grep, sed, and awk; we
can't help you if you fail to read release notes from your distribution.

The solution is the same as you would do on Linux: preprocess your data
to strip out \r (or write patterns that specifically accommodate for
\r).  Or, for the case where your data resides on the file system, you
can use the cygwin-specific approach of making that directory a text
mount point rather than the default binary mount point, so that cygwin
will strip the \r on your behalf.

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]