--text option of grep v3.7-2 not working

Thomas Wolff towo@towo.net
Wed Nov 16 16:53:09 GMT 2022



Am 16/11/2022 um 13:50 schrieb Ilya Zakharevich:
> grep with -a (or --text) option does not strip CR from line ends
>
> 	Broken in: CYGWIN_NT-6.1     Bu 3.3.4(0.341/5/3) 2022-01-31 19:35 x86_64 Cygwin
> 	       	   grep (GNU grep) 2.21
>
> 	Works  in: CYGWIN_NT-6.1-WOW Bu 2.2.1(0.289/5/3) 2015-08-20 11:40 i686   Cygwin
> 	       	   grep (GNU grep) 3.7
> 	       	   Packaged by Cygwin (3.7-2)
>
> To reproduce, do in CMD’s command line:
>
>    D:\> D:\Programs\cygwin2022\bin\perl -we "print qq(abc\r\n)" | D:\Programs\cygwin2022\bin\grep -a "abc$"
>
> This does not emit anything (contrary to the man page, which says:
>
>        If grep decides the file is a text file, it strips the CR
>        characters from the original file contents (to make regular
>        expressions with ^ and $ work correctly).
This section in the manpage is preceded by
      By default, under MS-DOS  and  MS-Windows,  grep  guesses whether  
a  file  is  text or binary as described for the --binary-files option.
which may be interpreted so that this stripping only occurs in the 
DOS/Windows versions, which the cygwin version isn't.
If you think this is unclear, as the Linux version behaves the same way, 
you should report this upstream.

>
> (The same happens on Win10.)
>
> Hope this helps,
> Ilya
>
> P.S.  It seems that the mailing list does not allow attaching the output!
>          So I retry with a shortened version…
>




More information about the Cygwin mailing list