Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream changes to newline handling in sed/awk/etc. #822

Closed
Mistuke opened this issue Feb 23, 2017 · 2 comments
Closed

Upstream changes to newline handling in sed/awk/etc. #822

Mistuke opened this issue Feb 23, 2017 · 2 comments

Comments

@Mistuke
Copy link

Mistuke commented Feb 23, 2017

A recent change in the upstream packages sed, awk etc change the behaviour of how the tools handle newline characters by switching from text mode to binary mode for input.

This is disastrous for Windows as it means $ no longer matches end of line. So all scripts are potentially broken. See https://ghc.haskell.org/trac/ghc/ticket/13315

The proposed solution on the cygwin mailing list of using dos2unix everywhere is non-trivial and requires massive amount of code changes to deal with this.

using text mounts partially solves the problem for files read from disk, but does not fix the issue when piping data. As such, can these patches be reverted for MSYS2? It seems like it's not the desired behaviour we want or expect on Windows.

Testcase:

older MSYS2:

Core@CI-01 MINGW64 ~
$ printf "hello world\r\n234" | sed -e 's/world$/irc/g'
hello irc
234
Core@CI-01 MINGW64 ~
$ printf "hello world\n234" | sed -e 's/world$/irc/g'
hello irc
234

new MSYS2:

Core@CI-02 MINGW64 ~
$ printf "hello world\r\n234" | sed -e 's/world$/irc/g'
hello world
234
Core@CI-02 MINGW64 ~
$ printf "hello world\n234" | sed -e 's/world$/irc/g'
hello irc
234
@elieux
Copy link
Member

elieux commented Feb 23, 2017

We had success patching sed back to reading in text mode. It'll be uploaded soon, I hope.

@Mistuke
Copy link
Author

Mistuke commented Feb 24, 2017

Thanks, I can confirm that this now works again!

@Mistuke Mistuke closed this as completed Feb 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants