coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [coreutils] [PATCH] tests: avoid portability problem with dash vs. l


From: Jim Meyering
Subject: Re: [coreutils] [PATCH] tests: avoid portability problem with dash vs. local v=$splittable_val
Date: Mon, 08 Nov 2010 14:10:25 +0100

Pádraig Brady wrote:
> On 08/11/10 12:20, Jim Meyering wrote:
>
>> +  case $init_delay in
>> +  ''|[^+.0-9]) fail_ "invalid delay: $init_delay; internal error"
>
> You need ** around the above I think like:
> +  ''|*[^+.0-9]*) fail_ "invalid delay: $init_delay; internal error"

Thanks!  Corrected.
[note that it doesn't catch ".", "....", "++..", etc]

Saving for some other day...

>From bf3ed279b13a4083e24112fee74794a6a82c5f70 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 8 Nov 2010 13:11:05 +0100
Subject: [PATCH] tests: diagnose potential internal error

* tests/init.cfg (retry_delay_): Fail upon invalid init_delay,
and remove now-unneeded quotes in awk invocation.
---
 tests/init.cfg |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/tests/init.cfg b/tests/init.cfg
index 97dad17..f0fd6d6 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -383,17 +383,21 @@ working_umask_or_skip_()
 retry_delay_()
 {
   local test_func=$1
   local init_delay=$2
   local max_n_tries=$3

+  case $init_delay in
+  ''|*[^+.0-9]*) fail_ "invalid delay: $init_delay; internal error"
+  esac
+
   local attempt=1
   local num_sleeps=$attempt
   local time_fail
   while test $attempt -le $max_n_tries; do
-    local delay=$($AWK -v n=$num_sleeps -v s="$init_delay" \
+    local delay=$($AWK -v n=$num_sleeps -v s=$init_delay \
                   'BEGIN { print s * n }')
     "$test_func" "$delay" && { time_fail=0; break; } || time_fail=1
     attempt=$(expr $attempt + 1)
     num_sleeps=$(expr $num_sleeps '*' 2)
   done
   test "$time_fail" = 0
--
1.7.3.2.332.gec4f8



reply via email to

[Prev in Thread] Current Thread [Next in Thread]