X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=Mq7tUq+sdyVEVJfb la+4G8wJYoRWl8Oz3Oi/A9OYCbg6AiVJAyquMsOlnO0GF0dprVlpVqDOE0qNp6Dp SPUK6qiJryC3ENSCJ7k0NF7AFzGC9TBc6s/jJMGmrJJc3UOGLZsbwcx59a7KG9yA VZeveoYg3onVBkLZuqSqs3wmPI8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:reply-to:subject:to:references:from:message-id :date:mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=OM36Wo2nZAPBMHB1HLDPJs l+eKo=; b=GEzYhdGwtIh6WW4hWYC+jjHd5t93awAgojBU8wYCl0JTuDJBQF9Axd SszCSMRAeQuEad5EFSggIx5CNz6hIiFLBx3R4QtLBnv7BLeKASYjVZKJVVcmi1ni 4tS/WRPkKKWEsjkwSRBuqdn2PEXX6ljXCzTs+QvNAbgjH25Iu0uUU= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=brian, Brian, H*r:sk:smtp-ou, inglis X-HELO: smtp-out-so.shaw.ca X-Authority-Analysis: v=2.2 cv=UpATD64B c=1 sm=1 tr=0 a=MVEHjbUiAHxQW0jfcDq5EA==:117 a=MVEHjbUiAHxQW0jfcDq5EA==:17 a=IkcTkHD0fZMA:10 a=thU6bClibDrZwtkNZM8A:9 a=QEXdDO2ut3YA:10 Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca Subject: Re: CR-LF handling behavior of SED changed recently - this breaks a lot of MinGW cross build scripts To: cygwin AT cygwin DOT com References: <0F7D3B1B3C4B894D824F5B822E3E5A175B2636E4 AT IRSMSX103 DOT ger DOT corp DOT intel DOT com> <0F7D3B1B3C4B894D824F5B822E3E5A175B26CE47 AT IRSMSX102 DOT ger DOT corp DOT intel DOT com> From: Brian Inglis Message-ID: <65acc4a5-6e8e-2f72-4933-263572dc2631@SystematicSw.ab.ca> Date: Fri, 9 Jun 2017 07:50:04 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <0F7D3B1B3C4B894D824F5B822E3E5A175B26CE47@IRSMSX102.ger.corp.intel.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfJu1Z5E3Jrai6dNLACUvDkB59n7l7P7tPfq2YOT0PkATJweIKUMV7wE22QYvRh/tJqkCitYL15XlldRvrBDfef8reLJasrXq9TbJ13SqCOpqgW4IiOen pZE6jbwyd9Ca6DV3L89btgpKuiuQQcGyb9XfDmzxR/GhtGrsw6HGEX46FbqokOdAmo39Jc4DXEDGig== X-IsSubscribed: yes 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|\|& -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