Web lists-archives.com

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





On 6/9/2017 11:51 AM, Eric Blake wrote:
> On 06/09/2017 10:01 AM, Soegtrop, Michael wrote:
>> Dear cyg Simple,
>>
>>> but it would be most beneficial if you caused the stdio of your
>>> Windows applications to be in binary format instead of text format.  Then the
>>> CR wouldn't be an issue during the pipe process.  Why does your applications
>>> stdio need to be in text format instead of binary format?
>>
>> it is not my application I have issues with. I am building many open source tools and libraries which are maintained by others, and as you said, these others have every right to deny implementing windows specific workarounds in their tools or build scripts. Why should anybody use "wb" mode to open a file in a Linux centric app 
> 
> Using "wb" is GOOD practice in programs like tar, that WANT to produce
> their output as binary no matter what.
> 
> But you are mixing things up.  "wb" is binary mode, but manipulating CRs
> is only done in text mode.  Text mode is only possible with "wt" (a
> Cygwin extension that doesn't work elsewhere), or with "w" (depending on
> the underlying mount - on Cygwin, "w" is text on text mode mounts, and
> binary on pipelines and binary mode mounts) (on other platforms, "w" is
> always text mode, but indistinguishable from "wb" binary mode).
> 

Uhm, 'wt' and 'wb' came from MS itself.  GNU GCC was adapted to allow it
and just ignores it on systems that don't need it.

>> or mess around with the input of sed to remove CRs in a build script for such an app?
> 
> If you are writing a Linux app that processes data produced on a windows
> machine, then YOU must strip CR from that data (Linux sed will NOT strip
> it).  So now cygwin sed does the same thing.
> 
>> Of cause the same is true for cygwin, except that I think building MinGW apps is an intended use case for cygwin. 
> 
> Building mingw apps may be one use of cygwin, but it is not the
> "intended use case".  The intended use case of cygwin is to emulate as
> much as possible of a linux environment.  If building for mingw on Linux
> requires you to explicitly strip CR when dealing with data from Windows,
> then so should building for mingw on Cygwin.
> 

Exactly.  The other option is to use MSYS where this issue is dealt with.

-- 
cyg Simple

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