coreutils
[Top][All Lists]
Advanced

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

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


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

Hi Pádraig,

When running make check SHELL=dash, I got one failure.
It was in misc/stat-birthtime, due to its use retry_delay_:

  + num_sleeps=16
  + test 5 -le 5
  + gawk -v n=16 -v s=.07 BEGIN { for (i=0;i<n;i++) t = s" "t; print t }
  + local delay=.07 .07 .07 .07 .07 .07 .07 .07 .07 .07 .07 .07 .07 .07 .07 .07
  local: 1: .07: bad variable name


>From bda912213e8605121226ce2e07951f1b682ef595 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 6 Nov 2010 18:04:45 +0100
Subject: [PATCH] tests: avoid portability problem with dash vs. local 
v=$splittable_val

* tests/init.cfg (retry_delay_): Put "local var" in a statement before
"var=...", to avoid portability problems with dash, when the RHS value
contains white space.
---
 tests/init.cfg |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/init.cfg b/tests/init.cfg
index 7786257..fa1f0e8 100644
--- a/tests/init.cfg
+++ b/tests/init.cfg
@@ -390,8 +390,9 @@ retry_delay_()
   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" \
-                  'BEGIN { for (i=0;i<n;i++) t = s" "t; print t }')
+    local delay
+    delay=$($AWK -v n=$num_sleeps -v s="$init_delay" \
+            'BEGIN { for (i=0;i<n;i++) t = s" "t; print t }')
     "$test_func" "$delay" && { time_fail=0; break; } || time_fail=1
     attempt=$(expr $attempt + 1)
     num_sleeps=$(expr $num_sleeps '*' 2)
--
1.7.3.2.193.g78bbb



reply via email to

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