ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jwadamson <...@git.apache.org>
Subject [GitHub] ant issue #24: fix 60150 values containing backtick or $ character cause she...
Date Fri, 07 Oct 2016 19:58:57 GMT
Github user jwadamson commented on the issue:

    https://github.com/apache/ant/pull/24
  
    playing with this alternate impl for now. So far works with dash and ksh and a torture
parameter:
    
    $ ./bin/ant --execdebug run "-Dfoo=dollar\$backtick\`single'double\"backslash\\"
    
    ```
    # wrap all arguments as "" strings, escape any internal back-slash, double-quote, $, or
back-tick characters
    #    ant_exec_args="$ant_exec_args \"$(printf '%s\n' "$arg" | sed -e 's@\$\|`\|"\|\\@\\\0@g'
)\""
    #    quoted_arg=`printf '%s\n' \"$arg\"`
    #    esc_arg=`echo "$quoted_arg" | sed -e 's@"|\\\@\\\0@g'`
    
        # escape $, ", and \ characters by inserting a \
        esc_arg=`echo "$arg" | sed -e 's@[$"\\]@\\\\\\\\\0@g' `
        # escape ` by inserting a \
        esc_arg=`echo "$esc_arg" | sed -e 's@\`@\\\\\`@g'`
        # wrap escaped arg as a quoted argument
        quoted_arg="\"$esc_arg\""
        echo "arg       : $arg"
        echo "esc_arg   : $esc_arg"
        echo "quoted_arg: $quoted_arg"
        ant_exec_args="$ant_exec_args $quoted_arg"
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message