* [LTP] [PATCH 1/1] shell: Fix handling default parameters in tst_mkfs()
@ 2019-03-27 15:52 Petr Vorel
2019-03-27 16:03 ` Cyril Hrubis
0 siblings, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2019-03-27 15:52 UTC (permalink / raw)
To: ltp
fixes regression when testing df01.sh
Dash does not like shifting more than possible:
/opt/ltp/testcases/bin/df01.sh: 291: shift: can't shift that many
Fixes: 465faf47f ("shell: Use $TST_FS_TYPE and $TST_DEVICE in tst_mkfs()")
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Hi,
don't like checking $# twice, but don't see right now way to do it
simpler.
Sorry for introducing regression.
Kind regards,
Petr
---
testcases/lib/tst_test.sh | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index af16ce1cf..d3905d378 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -288,7 +288,8 @@ tst_mkfs()
{
local fs_type=${1:-$TST_FS_TYPE}
local device=${2:-$TST_DEVICE}
- shift 2
+ [ $# -eq 1 ] && shift 1
+ [ $# -ge 2 ] && shift 2
local fs_opts="$@"
if [ -z "$fs_type" ]; then
--
2.21.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH 1/1] shell: Fix handling default parameters in tst_mkfs()
2019-03-27 15:52 [LTP] [PATCH 1/1] shell: Fix handling default parameters in tst_mkfs() Petr Vorel
@ 2019-03-27 16:03 ` Cyril Hrubis
2019-03-27 16:21 ` Petr Vorel
2019-04-04 14:30 ` Petr Vorel
0 siblings, 2 replies; 4+ messages in thread
From: Cyril Hrubis @ 2019-03-27 16:03 UTC (permalink / raw)
To: ltp
Hi!
> fixes regression when testing df01.sh
>
> Dash does not like shifting more than possible:
> /opt/ltp/testcases/bin/df01.sh: 291: shift: can't shift that many
>
> Fixes: 465faf47f ("shell: Use $TST_FS_TYPE and $TST_DEVICE in tst_mkfs()")
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> Hi,
>
> don't like checking $# twice, but don't see right now way to do it
> simpler.
We can do the same thing twice as well, which may be a bit more
readable:
[ $# -ge 1 ] && shift
[ $# -ge 1 ] && shift
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH 1/1] shell: Fix handling default parameters in tst_mkfs()
2019-03-27 16:03 ` Cyril Hrubis
@ 2019-03-27 16:21 ` Petr Vorel
2019-04-04 14:30 ` Petr Vorel
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2019-03-27 16:21 UTC (permalink / raw)
To: ltp
Hi Cyril,
> We can do the same thing twice as well, which may be a bit more
> readable:
> [ $# -ge 1 ] && shift
> [ $# -ge 1 ] && shift
I'd prefer my way, as this looks like entered twice by accident.
But you chose the variant :).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
* [LTP] [PATCH 1/1] shell: Fix handling default parameters in tst_mkfs()
2019-03-27 16:03 ` Cyril Hrubis
2019-03-27 16:21 ` Petr Vorel
@ 2019-04-04 14:30 ` Petr Vorel
1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2019-04-04 14:30 UTC (permalink / raw)
To: ltp
Hi Cyril,
> We can do the same thing twice as well, which may be a bit more
> readable:
> [ $# -ge 1 ] && shift
> [ $# -ge 1 ] && shift
Merged your variant. It's really more readable.
Thanks!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-04-04 14:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 15:52 [LTP] [PATCH 1/1] shell: Fix handling default parameters in tst_mkfs() Petr Vorel
2019-03-27 16:03 ` Cyril Hrubis
2019-03-27 16:21 ` Petr Vorel
2019-04-04 14:30 ` Petr Vorel
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.