net/sctp: Fix parsing input variables in dash
PATCH 1/1 net/sctp: Fix parsing input variables in dash
Dash (and maybe some other posix shells) cannot handle unquoted $@. It needs to be quoted when calling otherwise leads to error:/opt/ltp/testcases/bin/sctp01.sh: 40: local: 65000: bad variable name
This is a quick fix, better than working with input parameters would be add another test case in runtest/net.features.
--- testcases/network/sctp/sctp01.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
testcases/network/sctp/sctp01.sh +1 -1
@@ -58,6 +58,6 @@ test_run() setup test_run -test_run -A 65000 +test_run '-A 65000' tst_exit
Signature · 1 line
2.16.3
PATCH 1/1 net/sctp: Fix parsing input variables in dash
Hi!
Quoted 3 lines
Dash (and maybe some other posix shells) cannot handle unquoted $@. It needs to be quoted when calling otherwise leads to error:
/opt/ltp/testcases/bin/sctp01.sh: 40: local: 65000: bad variable name
It looks like this patch is working around the real problem.
Looking into bash and dash manual pages the syntax for local builtin is slightly differente between these two.
The dash contains:
local [variable | -] ...
While bash has:
local [option] [name[=value] ... | - ]
So it looks to me like the portable way how to declare local variables is:
function()
{
local var_name
var_name=$foo
...
}And it also seems to be mentioned in one of the dash porting guides:
http://mywiki.wooledge.org/Bashism
See the builtins paragraph there.
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 net/sctp: Fix parsing input variables in dash
Hi Cyril,
Quoted 31 lines
Hi!
Quoted 3 lines
Dash (and maybe some other posix shells) cannot handle unquoted $@. It needs to be quoted when calling otherwise leads to error:
/opt/ltp/testcases/bin/sctp01.sh: 40: local: 65000: bad variable nameIt looks like this patch is working around the real problem.
Looking into bash and dash manual pages the syntax for local builtin is slightly differente between these two.
The dash contains:
local [variable | -] ...
While bash has:
local [option] [name[=value] ... | - ]
So it looks to me like the portable way how to declare local variables is:
function(){ local var_name var_name=$foo ... }
Quoted 5 lines
And it also seems to be mentioned in one of the dash porting guides:
http://mywiki.wooledge.org/Bashism
See the builtins paragraph there.
Thanks for explanation!
Pushed your way, with your Acked-by and Suggested-by.
Kind regards,
Petr