This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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

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

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

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization: |

Attachment: signature.asc
Description: OpenPGP digital signature

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]