Subject: bug#30251: REMOVE bllank line on DOS file format

From: Assaf Gordon <[email-masked]>
Date: Thu, 25 Jan 2018 14:59:21 -0700

Hello,

On Thu, Jan 25, 2018 at 01:25:35PM +0000, Mauro Rigoni wrote:
> with the last x86_32 version of sed (windows platform) the
> following pattern
> 
> sed '\?^$?D'
> 
> don’t remove blank line from file if the file is in DOS format. In the
> previous version 2.2 this command working.

First,
Sed version 2.X is more than 20 years old. It is not the previous version.
The previous (and most common) version is version 4.2.2 from 2012.
Can you test your sed program with version 4.2.2 ?

Second,
A question about your sed program:
Does the problem still happen if you use the following?
   sed '/^$/d'

That is, regex with slashes (instead of '\?')
and using lower-case 'd' (simple delete command)
instead of 'D' (which is slightly more complicated
and deals with multilined buffers).

Third,
I do not have access to a windows machine, so a bit more information
is needed:
1. Which windows version are you using?
2. Which cygwin version are you using?
(I assume it is cygwin based on the version string)
3. Can you try the same sed command, but add the '--binary' flag,
   if does it show the same results?

For reference,
there is are two bug reports related to newlines with sed on windows.
https://bugs.gnu.org/25459 and https://bugs.gnu.org/26879 .

Specifically, note here https://debbugs.gnu.org/cgi/bugreport.cgi?bug=26879#12
where Eric Blake mentions that cygwin modified some internal
behaviour related to binary-vs-text files in February 2017.

regards,
 - assaf