Web lists-archives.com

CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts

Dear Cygwin Team,

in the latest version of cygwin with sed-4.4-1.tar.bz2 the behavior of sed regarding handling CR-LF sequences changed. The last version I tried where this was still working is sed-4.2.2-3.tar.bz2.

I would say that the documented behavior in both versions is that they replace CR-LF with LF, because both version have a documented option -b to switch of this behavior. But in version 4.4-1 this doesn't work anymore. This breaks a lot of build scripts, because var=$( prog | sed .) now usually adds a carriage return to the variable in case the called prog is a MinGW program - a common scenario in MinGW cross development.

Is this considered a bug in sed 4.4-1 or is the old behavior and the -b option considered deprecated and it was just forgotten to remove the documentation for the -b option?

Best regards,


Old behavior (sed 4.2.2-3):

$ echo -e "a\r\nb\r\nc\r" | sed 's/a//' | hexdump -C
+ echo -e 'a\r\nb\r\nc\r'
+ sed s/a//
+ hexdump -C
00000000  0a 62 0a 63 0a                                    |.b.c.|

New behavior (sed 4.4-1):

$ echo -e "a\r\nb\r\nc\r" | sed 's/a//' | hexdump -C
+ echo -e 'a\r\nb\r\nc\r'
+ sed s/a//
+ hexdump -C
00000000  0d 0a 62 0d 0a 63 0d 0a                           |..b..c..|
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple