Github user jeking3 commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1354#discussion_r138770754
  
    --- Diff: aclocal/ax_javac_and_java.m4 ---
    @@ -118,7 +118,7 @@ AC_DEFUN([AX_CHECK_JAVA_CLASS],
     AC_DEFUN([AX_CHECK_ANT_VERSION],
              [
               AC_MSG_CHECKING(for ant version > $2)
    -          ANT_VALID=`expr $($1 -version 2>/dev/null | sed -n 's/.*version 
\(@<:@0-9\.@:>@*\).*/\1/p') \>= $2`
    +          ANT_VALID=`expr "x$(printf "$2\n$($1 -version 2>/dev/null | sed 
-n 's/.*version \(@<:@0-9\.@:>@*\).*/\1/p')" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 
-g | sed -n 1p)" = "x$2"`
    --- End diff --
    
    I don't see this working on my bash shell:
    
    ```
    jking@ubuntu:~/thrift/github/thrift$ ant -version
    Apache Ant(TM) version 1.9.8 compiled on January 19 2017
    
    jking@ubuntu:~/thrift/github/thrift$ ant -version | sed -n 's/.*version 
\(@<:@0-9\.@:>@*\).*/\1/p'
    (no output)
    ```
    
    Try this instead:
    ```
    jking@ubuntu:~/thrift/github/thrift$ ant -version | cut -d' ' -f4
    1.9.8
    ```
    
    Test:
    
    If I require 1.9.9, fails, if I require 1.9.7, passes:
    ```
    jking@ubuntu:~/thrift/github/thrift$ expr "x$(printf "1.9.9\n$(ant -version 
| cut -d' ' -f4)" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -g | sed -n 1p)" = "x1.9.9"
    0
    jking@ubuntu:~/thrift/github/thrift$ expr "x$(printf "1.9.7\n$(ant -version 
| cut -d' ' -f4)" | sort -t '.' -k 1,1 -k 2,2 -k 3,3 -g | sed -n 1p)" = "x1.9.7"
    1
    ```


---

Reply via email to