All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH] fs/binfmt_misc02.sh: Fix local variable assignment for dash
Date: Tue, 22 Oct 2019 14:44:53 -0300	[thread overview]
Message-ID: <20191022174452.GB4055@calabresa> (raw)
In-Reply-To: <20191022025456.15711-1-ice_yangxiao@163.com>

On Tue, Oct 22, 2019 at 10:54:56AM +0800, Xiao Yang wrote:
> Only the first one can be accepted if more than one string are assigned
> to local valiable.  For example, only "This" is assigned to $string:
> ------------------------------------
> tstring="This is test for extension"
> ...
> local string=$tstring
> ------------------------------------
> 
> We add a pair of quotes to fix the issue now. Besides we can also fix
> the issue by splitting declaration and assignment(e.g. local string &
> string=$tstring).
> 
> See the explanation from:
> https://wiki.ubuntu.com/DashAsBinSh#local
> 
> Fixes: #601
> Reported-by: limingyu <limingyu@deepin.com>
> Suggested-by: limingyu <limingyu@deepin.com>
> Signed-off-by: Xiao Yang <ice_yangxiao@163.com>

This fixes a problem we have been seeing.

Tested-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

> ---
>  testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh b/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh
> index 8d0ecd895..9dbcd68cc 100755
> --- a/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh
> +++ b/testcases/kernel/fs/binfmt_misc/binfmt_misc02.sh
> @@ -26,7 +26,7 @@ TST_NEEDS_CMDS="which cat head"
>  recognised_unrecognised()
>  {
>  	local file=$1
> -	local string=$2
> +	local string="$2"
>  
>  	eval $file >temp 2>&1
>  	if [ $? -ne 0 ] || ! grep -q "$string" temp; then
> @@ -52,7 +52,7 @@ recognised_unrecognised()
>  unrecognised()
>  {
>  	local file=$1
> -	local string=$2
> +	local string="$2"
>  
>  	eval $file >temp 2>&1
>  	if [ $? -eq 0 ] || grep -q "$string" temp; then
> -- 
> 2.21.0
> 
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2019-10-22 17:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-22  2:54 [LTP] [PATCH] fs/binfmt_misc02.sh: Fix local variable assignment for dash Xiao Yang
2019-10-22 17:44 ` Thadeu Lima de Souza Cascardo [this message]
2019-10-23  1:27   ` root

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=20191022174452.GB4055@calabresa \
    --to=cascardo@canonical.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.