[jbossts-issues] [JBoss JIRA] (JBTM-1254) Simplify narayana.sh by removing ability to have empty IPV6_OPTS

Michael Musgrove (JIRA) jira-events at lists.jboss.org
Mon Sep 17 06:54:34 EDT 2012

    [ https://issues.jboss.org/browse/JBTM-1254?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12719030#comment-12719030 ] 

Michael Musgrove commented on JBTM-1254:

I disagree, the use of || and && had nothing to do with the bug.

As an aside the use of || (or &&) clarifies the meaning since it reduces clutter in an otherwise complex script (it is generally only ever used for simple one liners). What I can agree with is the use of || and && in the same test does obfuscate and this only crept into the script because of an oversight.
> Simplify narayana.sh by removing ability to have empty IPV6_OPTS
> ----------------------------------------------------------------
>                 Key: JBTM-1254
>                 URL: https://issues.jboss.org/browse/JBTM-1254
>             Project: JBoss Transaction Manager
>          Issue Type: Feature Request
>      Security Level: Public(Everyone can see) 
>            Reporter: Paul Robinson
>            Assignee: Paul Robinson
>             Fix For: 4.17.0, 5.0.0.M2
> We currently use [ -z "${VAR+c}" ] notation to detect if a variable has been set, allowing for it being set to the empty string. Here's an example:
> {code}
>   # if IPV6_OPTS is not set get the jdbc drivers (we do not run the jdbc tests in IPv6 mode)
>   [ -z "${IPV6_OPTS+x}" ] && ant -DisIdlj=$IDLJ "$QA_BUILD_ARGS" get.drivers dist ||
>     ant -DisIdlj=$IDLJ "$QA_BUILD_ARGS" dist
> {code} 
> The problem with this approach is that it's rather cryptic to understand what's going on. This makes it hard to read and easy to create a bug. We've had two bugs so far, due to this syntax.
> By removing the ability to "export IPV6_OPTS=", we can simplify these portions of the script to look like:
> {code}
> if [ "${IPV6_OPTS}" = "" ]; then
> 	ant -DisIdlj=$IDLJ "$QA_BUILD_ARGS" get.drivers dist
> else
> 	ant -DisIdlj=$IDLJ "$QA_BUILD_ARGS" dist
> fi
> {code}
> Which is a lot easier to read and much less error-prone.
> Should we ever need to enable IPv6 without setting any IPv6 options, we could either re-instate the old code, or set a dummy option. 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

More information about the jbossts-issues mailing list