RFR: JDK-8036145: Solaris standard grep does not understand -qE

Erik Joelsson erik.joelsson at oracle.com
Mon Mar 3 16:56:01 UTC 2014


It seems I failed in the below fix. /usr/bin/grep on Solaris does not 
support -qE. Here is another patch, converting the regexp to work 
without the -E switch and piping to /dev/null to keep it quiet:

Bug: https://bugs.openjdk.java.net/browse/JDK-8036145

diff --git a/common/autoconf/configure b/common/autoconf/configure
--- a/common/autoconf/configure
+++ b/common/autoconf/configure
@@ -127,11 +127,11 @@
    if [[ -n "$1" ]]; then
      # Uses only shell-safe characters?  No quoting needed.
      # '=' is a zsh meta-character, but only in word-initial position.
-    if echo "$1" | grep -qE 
'^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$' 
\
-        && ! echo "$1" | grep -qE '^='; then
+    if echo "$1" | grep 
'^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\.:,%/+=_-]\{1,\}$' 
 > /dev/null \
+        && ! echo "$1" | grep '^=' > /dev/null; then
        quoted="$1"
      else
-      if echo "$1" | grep -qE "[\'!]"; then
+      if echo "$1" | grep "[\'!]" > /dev/null; then
          # csh does history expansion within single quotes, but not
          # when backslash-escaped!
          local quoted_quote="'\\''" quoted_exclam="'\\!'"

/Erik

On 2014-02-27 15:04, Erik Joelsson wrote:
> JDK-8034199 unfortunately didn't work with a bunch of internal Solaris 
> installations. It seems common for Solaris 10 to not have an updated 
> bash version and the =~ construct used in that patch requires bash 3.x 
> or higher.
>
> Here is a rewrite of that part using grep.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8035904
>
> Patch inline:
>
> diff -r 73d85b04c45c common/autoconf/configure
> --- a/common/autoconf/configure
> +++ b/common/autoconf/configure
> @@ -127,10 +127,11 @@
>    if [[ -n "$1" ]]; then
>      # Uses only shell-safe characters?  No quoting needed.
>      # '=' is a zsh meta-character, but only in word-initial position.
> -    if [[ "$1" =~ 
> ^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$ 
> && ! "$1" =~ ^= ]]; then
> +    if echo "$1" | grep -qE 
> '^[ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.:,%/+=_-]+$' 
> \
> +        && ! echo "$1" | grep -qE '^='; then
>        quoted="$1"
>      else
> -      if [[ "$1" =~ [\'!] ]]; then
> +      if echo "$1" | grep -qE "[\'!]"; then
>          # csh does history expansion within single quotes, but not
>          # when backslash-escaped!
>          local quoted_quote="'\\''" quoted_exclam="'\\!'"
>
>
> /Erik




More information about the build-dev mailing list