tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Cole (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (OPENEJB-2065) Change 1482211 causes shell error if bin/openejb is given more than one argument
Date Sat, 04 Jan 2014 06:32:50 GMT

     [ https://issues.apache.org/jira/browse/OPENEJB-2065?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Bill Cole updated OPENEJB-2065:
-------------------------------

    Description: 
$@ is always word-split, even inside doublequotes. Hence line 83:

if [ "x$@" = "xdebug" ]; then

throws a shell syntax error (in bash "too many arguments", in BSD sh "unexpected operator"
) if the script is given multiple arguments (such as those documented in README.txt) because
"x$@" is expanded to  x$1 $2 [...] $n NOT "x$1 $2 [...] $n"

The cleanest fix is to change line 83 to:

if [ "$1" = "debug" ]; then

This is a precise check for whether the first argument to the script is "debug" and clearly
that's the only relevant argument in such a case, as the "then" clause causes any other args
to be ignored. 




  was:
$@ is always word-split, even inside doublequotes. Hence line:

if [ "x$@" = "xdebug" ]; then

throws a shell syntax error (in bash "too many arguments", in BSD sh "unexpected operator"
) if the script is given multiple arguments (such as those documented in README.txt) because
"x$@" is expanded to  x$1 $2 [...] $n NOT "x$1 $2 [...] $n"

The cleanest fix is to change line 83 to:

if [ "$1" = "debug" ]; then

This is a precise check for whether the first argument to the script is "debug" and clearly
that's the only relevant argument in such a case, as the "then" clause causes any other args
to be ignored. 





> Change 1482211 causes shell error if bin/openejb is given more than one argument
> --------------------------------------------------------------------------------
>
>                 Key: OPENEJB-2065
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-2065
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 4.6.0
>         Environment: Any OS with a POSIX shell (sh, ksh, bash, etc) 
>            Reporter: Bill Cole
>              Labels: easyfix
>   Original Estimate: 5m
>  Remaining Estimate: 5m
>
> $@ is always word-split, even inside doublequotes. Hence line 83:
> if [ "x$@" = "xdebug" ]; then
> throws a shell syntax error (in bash "too many arguments", in BSD sh "unexpected operator"
) if the script is given multiple arguments (such as those documented in README.txt) because
"x$@" is expanded to  x$1 $2 [...] $n NOT "x$1 $2 [...] $n"
> The cleanest fix is to change line 83 to:
> if [ "$1" = "debug" ]; then
> This is a precise check for whether the first argument to the script is "debug" and clearly
that's the only relevant argument in such a case, as the "then" clause causes any other args
to be ignored. 



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

Mime
View raw message