Linux Test Project
 help / color / mirror / Atom feed
* [LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash
@ 2018-05-15  9:40 Petr Vorel
  2018-05-15 12:04 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2018-05-15  9:40 UTC (permalink / raw)
  To: ltp

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.

Fixes: 7ade6a32e ("sctp: add test-case with random payload")

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/sctp/sctp01.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/network/sctp/sctp01.sh b/testcases/network/sctp/sctp01.sh
index bf13521c2..c4149af19 100755
--- a/testcases/network/sctp/sctp01.sh
+++ b/testcases/network/sctp/sctp01.sh
@@ -58,6 +58,6 @@ test_run()
 
 setup
 test_run
-test_run -A 65000
+test_run '-A 65000'
 
 tst_exit
-- 
2.16.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash
  2018-05-15  9:40 [LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash Petr Vorel
@ 2018-05-15 12:04 ` Cyril Hrubis
  2018-05-15 13:11   ` Petr Vorel
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2018-05-15 12:04 UTC (permalink / raw)
  To: ltp

Hi!
> 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.

-- 
Cyril Hrubis
chrubis@suse.cz

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash
  2018-05-15 12:04 ` Cyril Hrubis
@ 2018-05-15 13:11   ` Petr Vorel
  0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2018-05-15 13:11 UTC (permalink / raw)
  To: ltp

Hi Cyril,

> Hi!
> > 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.

Thanks for explanation!
Pushed your way, with your Acked-by and Suggested-by.


Kind regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-15 13:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-15  9:40 [LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash Petr Vorel
2018-05-15 12:04 ` Cyril Hrubis
2018-05-15 13:11   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox