[lfs-support] coreutils (lfs-7.0, section 6.23)

Qrux qrux.qed at gmail.com
Fri Jan 13 03:00:40 PST 2012


On Jan 12, 2012, at 10:40 PM, <jasonpsage at jegas.com> wrote:

>> Ran the test suite for coreutils:
>> 
>> ====
>> root:/scripts# grep -i fail src/coreutils-8.14/gnulib-tests/test-suite.log
>> 1 of 270 tests failed.  (24 tests were not run).  
>> FAIL: test-parse-datetime (exit: 134)
>> test-parse-datetime.c:142: assertion failed
>> ====
>> 

Found the problem.  Apparently, coreutils-8.14 (the version for the LFS 7.0 release book) is broken w.r.t. to that specific test.  It's a DST issue, so maybe the folks who were working with LFS-7.0 in the summer didn't notice the breakage.  I see that coreutils is already at 8.15 in SVN, so I assume the devs have already moved on from this problem.  But, for those who want to build the 7.0 release book, you'll likely need this patch.

The URL references:

	* http://osdir.com/ml/bug-coreutils-gnu/2011-11/msg00176.html
	* http://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=56ddf0fdeb52ce76718e
	* http://git.savannah.gnu.org/cgit/gnulib.git/patch/?id=56ddf0fdeb52ce76718e0594db4f567401e90a2c

In my patch, I trimmed the top chunk (ChangeLog), since there are many other changes between 8.14 and this patch which cause the chunk to break.  I saved the patch as:

	coreutils-8.14-test-parse-datetime.patch

next to the other patch files, and added this line:

	patch -Np1 -i ../coreutils-8.14-test-parse-datetime.patch

right after the two patches in the book.  Coreutils will then build and pass all the tests.  In context, it looks like this:

	=================================
	case `uname -m` in
		i?86 | x86_64) patch -Np1 -i ../coreutils-8.14-uname-1.patch ;;
	esac

	patch -Np1 -i ../coreutils-8.14-i18n-1.patch

	patch -Np1 -i ../coreutils-8.14-test-parse-datetime.patch

	./configure --prefix=/usr \
	    --enable-no-install-program=kill,uptime

	make
	=================================

Full patch is below.  For those unfamiliar with the patch format, the "header" part that looks like a mail message is a valid part of the patch.  Only omit the "PATCH STARTS" and "PATCH ENDS" lines at the top & bottom.

		Q



========== PATCH STARTS AFTER HERE ============
From 56ddf0fdeb52ce76718e0594db4f567401e90a2c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering at redhat.com>
Date: Sun, 30 Oct 2011 17:12:54 +0000
Subject: test-parse-datetime.c: avoid new DST-related false positive test failure

diff --git a/gnulib-tests/test-parse-datetime.c b/gnulib-tests/test-parse-datetime.c
index b9d08a6..22fe9bc 100644
--- a/gnulib-tests/test-parse-datetime.c
+++ b/gnulib-tests/test-parse-datetime.c
@@ -94,20 +94,17 @@ tm_diff (struct tm const *a, struct tm const *b)
 #endif /* ! HAVE_TM_GMTOFF */
 
 static long
-gmt_offset ()
+gmt_offset (time_t s)
 {
-  time_t now;
   long gmtoff;
 
-  time (&now);
-
 #if !HAVE_TM_GMTOFF
-  struct tm tm_local = *localtime (&now);
-  struct tm tm_gmt   = *gmtime (&now);
+  struct tm tm_local = *localtime (&s);
+  struct tm tm_gmt   = *gmtime (&s);
 
   gmtoff = tm_diff (&tm_local, &tm_gmt);
 #else
-  gmtoff = localtime (&now)->tm_gmtoff;
+  gmtoff = localtime (&s)->tm_gmtoff;
 #endif
 
   return gmtoff;
@@ -123,16 +120,17 @@ main (int argc _GL_UNUSED, char **argv)
   const char *p;
   int i;
   long gmtoff;
+  time_t ref_time = 1304250918;
 
   set_program_name (argv[0]);
 
-  gmtoff = gmt_offset ();
+  gmtoff = gmt_offset (ref_time);
 
 
   /* ISO 8601 extended date and time of day representation,
      'T' separator, local time zone */
   p = "2011-05-01T11:55:18";
-  expected.tv_sec = 1304250918 - gmtoff;
+  expected.tv_sec = ref_time - gmtoff;
   expected.tv_nsec = 0;
   ASSERT (parse_datetime (&result, p, 0));
   LOG (p, expected, result);
@@ -142,7 +140,7 @@ main (int argc _GL_UNUSED, char **argv)
   /* ISO 8601 extended date and time of day representation,
      ' ' separator, local time zone */
   p = "2011-05-01 11:55:18";
-  expected.tv_sec = 1304250918 - gmtoff;
+  expected.tv_sec = ref_time - gmtoff;
   expected.tv_nsec = 0;
   ASSERT (parse_datetime (&result, p, 0));
   LOG (p, expected, result);
@@ -153,7 +151,7 @@ main (int argc _GL_UNUSED, char **argv)
   /* ISO 8601, extended date and time of day representation,
      'T' separator, UTC */
   p = "2011-05-01T11:55:18Z";
-  expected.tv_sec = 1304250918;
+  expected.tv_sec = ref_time;
   expected.tv_nsec = 0;
   ASSERT (parse_datetime (&result, p, 0));
   LOG (p, expected, result);
@@ -163,7 +161,7 @@ main (int argc _GL_UNUSED, char **argv)
   /* ISO 8601, extended date and time of day representation,
      ' ' separator, UTC */
   p = "2011-05-01 11:55:18Z";
-  expected.tv_sec = 1304250918;
+  expected.tv_sec = ref_time;
   expected.tv_nsec = 0;
   ASSERT (parse_datetime (&result, p, 0));
   LOG (p, expected, result);
========== PATCH ENDS HERE ============




More information about the lfs-support mailing list