Linux Test Project
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH 1/1] net/sctp: Fix parsing input variables in dash
Date: Tue, 15 May 2018 14:04:28 +0200	[thread overview]
Message-ID: <20180515120428.GE7220@rei> (raw)
In-Reply-To: <20180515094053.18355-1-pvorel@suse.cz>

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

  reply	other threads:[~2018-05-15 12:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2018-05-15 13:11   ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180515120428.GE7220@rei \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox