* [LTP] [PATCH] fs/binfmt_misc02.sh: Fix local variable assignment for dash
@ 2019-10-22 2:54 Xiao Yang
2019-10-22 17:44 ` Thadeu Lima de Souza Cascardo
0 siblings, 1 reply; 3+ messages in thread
From: Xiao Yang @ 2019-10-22 2:54 UTC (permalink / raw)
To: ltp
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>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH] fs/binfmt_misc02.sh: Fix local variable assignment for dash
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
2019-10-23 1:27 ` root
0 siblings, 1 reply; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2019-10-22 17:44 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH] fs/binfmt_misc02.sh: Fix local variable assignment for dash
2019-10-22 17:44 ` Thadeu Lima de Souza Cascardo
@ 2019-10-23 1:27 ` root
0 siblings, 0 replies; 3+ messages in thread
From: root @ 2019-10-23 1:27 UTC (permalink / raw)
To: ltp
On 10/23/19 1:44 AM, Thadeu Lima de Souza Cascardo wrote:
> 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>
Hi Thadeu,
Pushed, thanks for your test.
Best Regards,
Xiao Yang
>
>> ---
>> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-23 1:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-10-23 1:27 ` root
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.