public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Brian Inglis <Brian.Inglis@SystematicSw.ab.ca>
To: cygwin@cygwin.com
Subject: Re: CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts
Date: Fri, 09 Jun 2017 13:50:00 -0000	[thread overview]
Message-ID: <65acc4a5-6e8e-2f72-4933-263572dc2631@SystematicSw.ab.ca> (raw)
In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A175B26CE47@IRSMSX102.ger.corp.intel.com>

On 2017-06-08 02:50, Soegtrop, Michael wrote:
>> No, the documented behavior is that CR-LF is converted to LF only 
>> for text- mounted files; but pipelines are default binary-mounted.
>> If you want to strip CR from a pipeline, then make it explicit.
>>> var=$( prog | sed .)
>> Rewrite that to var=$( prog | tr -d '\r' | sed .)

For compatibility var=$( prog | sed -b -e 's/\r$//' ...)

> I have two problems with this:
> 
> 1.) I build many (~ 50) unix libs and tools MinGW cross on cygwin 
> from sources and this breaks many of the configure and other scripts.
> Feeding back the fixes to the individual lib/tool maintainers will
> take quite some time and also results in lengthy discussion why they
> should care about crappy DOS artefacts at all. A compatibility option
> via environment variable would have been nice.

If your makefiles configured SED you could use:
export SED='sed -b -e '\''s/\r$$//'\'''
and that is probably the best approach: change sed to SED in makefiles,
and configure SED=sed if not set.

Alternatives:
alias sed='sed -b -e '\''s/\r$//'\'''
sed(){ /bin/sed -b -e 's/\r$//' "$@"; }
sed -i 's|\<sed\>|& -b e '\''s/\r$//'\''|g' ... to patch files - double
the "$" to patch makefiles,
or build and use a Mingw(-compatible) sed that converts \r\n to \n on
input and \n to \r\n on output?

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

--
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

  parent reply	other threads:[~2017-06-09 13:50 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-07 16:23 Soegtrop, Michael
2017-06-07 17:23 ` Eric Blake
2017-06-07 19:26   ` Brian Inglis
2017-06-08  8:50   ` Soegtrop, Michael
2017-06-08 13:31     ` Vince Rice
2017-06-08 14:52       ` Soegtrop, Michael
2017-06-08 15:04       ` Eric Blake
2017-06-08 15:08     ` Eric Blake
2017-06-08 17:34       ` cyg Simple
2017-06-08 18:51     ` L A Walsh
2017-06-08 19:57       ` Eric Blake
2017-06-09  8:14         ` Soegtrop, Michael
2017-06-09 14:06           ` cyg Simple
2017-06-09 15:01             ` Soegtrop, Michael
2017-06-09 15:35               ` Andrey Repin
2017-06-09 15:51               ` Eric Blake
2017-06-09 16:56                 ` Soegtrop, Michael
2017-06-09 18:42                   ` Hans-Bernhard Bröker
2017-06-09 19:30                     ` Erik Soderquist
2017-06-09 22:28                     ` Soegtrop, Michael
2017-06-09 22:43                       ` Harvey Stein
2017-06-09 23:16                       ` Ray Donnelly
2017-06-10 13:48                 ` cyg Simple
2017-06-10 14:21                   ` Hans-Bernhard Bröker
2017-06-11  2:31                   ` Eric Blake
2017-06-13 14:11                     ` cyg Simple
2017-06-13 17:34                       ` Brian Inglis
2017-06-14 16:07                         ` cyg Simple
2017-06-14 19:04                           ` Brian Inglis
2017-06-10 13:42               ` cyg Simple
2017-06-09 13:50     ` Brian Inglis [this message]
2017-06-09 15:05       ` Soegtrop, Michael
2017-06-09 15:35         ` Andrey Repin
2017-06-09 15:50           ` Dan Kegel
2017-06-09 16:09             ` Soegtrop, Michael
2017-06-10 21:09               ` Brian Inglis
2017-06-09 15:56           ` 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=65acc4a5-6e8e-2f72-4933-263572dc2631@SystematicSw.ab.ca \
    --to=brian.inglis@systematicsw.ab.ca \
    --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).