autoconf-patches
[Top][All Lists]
Advanced

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

AT_INIT: date +%s not portable


From: Ralf Wildenhues
Subject: AT_INIT: date +%s not portable
Date: Thu, 31 Mar 2005 10:11:34 +0200
User-agent: Mutt/1.4.1i

On solaris2.8, `date +%s' returns 0 and outputs '%s\n'.  Proposed patch fixes
bogus warning messages at the end of a `testsuite' run:

[...]
| 7. template.at:128:  FAILED (template.at:213)
| expr: non-numeric argument
| expr: syntax error
| expr: syntax error
| expr: syntax error
| expr: syntax error
| 
| ## ------------- ##
| ## Test results. ##
| ## ------------- ##

Regards,
Ralf

        * lib/autotest/general.m4 (AT_INIT): Work around `date' without %s.

Index: lib/autotest/general.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autotest/general.m4,v
retrieving revision 1.173
diff -u -r1.173 general.m4
--- lib/autotest/general.m4     23 Mar 2005 01:02:04 -0000      1.173
+++ lib/autotest/general.m4     31 Mar 2005 08:09:37 -0000
@@ -578,6 +578,7 @@
 
 at_start_date=`date`
 at_start_time=`date +%s 2>/dev/null || echo 0`
+test "X$at_start_time" = "X%s" && at_start_time=0
 echo "$as_me: starting at: $at_start_date" >&AS_MESSAGE_LOG_FD
 at_xpass_list=
 at_xfail_list=
@@ -757,6 +758,7 @@
 # Compute the duration of the suite.
 at_stop_date=`date`
 at_stop_time=`date +%s 2>/dev/null || echo 0`
+test "X$at_stop_time" = "X%s" && at_stop_time=0
 echo "$as_me: ending at: $at_stop_date" >&AS_MESSAGE_LOG_FD
 at_duration_s=`expr $at_stop_time - $at_start_time`
 at_duration_m=`expr $at_duration_s / 60`




reply via email to

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