RFR: JDK-8176033: New cygwin grep does not match \r as newline (original) (raw)

Tim Bell tim.bell at oracle.com
Wed Mar 1 14:06:25 UTC 2017


Erik:

Looks good to me.

Tim

In our configure code for rewriting cygwin paths reliably, we use this construct to find the root of the cygwin installation:

# The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away cygwinwinpathroot=cd / ; cmd /c cd | $GREP ".*" This used to work fine for a long time, but with the latest version of cygwin grep, it no longer removes \r from the string. A more robust implementation would be to instead use tr to explicitly remove both \r and \n. Bug: https://bugs.openjdk.java.net/browse/JDK-8176033 Patch: diff -r fe8466adaef8 common/autoconf/basicswindows.m4 --- a/common/autoconf/basicswindows.m4 Fri Feb 24 12:01:32 2017 +0100 +++ b/common/autoconf/basicswindows.m4 Wed Mar 01 10:50:44 2017 +0100 @@ -329,8 +329,8 @@ ACMSGERROR([Something is wrong with your cygwin installation since I cannot find cygpath.exe in your path]) fi ACMSGCHECKING([cygwin root directory as unix-style path]) - # The cmd output ends with Windows line endings (CR/LF), the grep command will strip that away - cygwinwinpathroot=cd / ; cmd /c cd | $GREP ".*" + # The cmd output ends with Windows line endings (CR/LF) + cygwinwinpathroot=cd / ; cmd /c cd | $TR -d '\r\n' # Force cygpath to report the proper root by including a trailing space, and then stripping it off again. CYGWINROOTPATH=$CYGPATH -u "$cygwinwinpathroot " | $CUT -f 1_ _-d " " ACMSGRESULT([$CYGWINROOTPATH])



More information about the build-dev mailing list