[PATCH] testsuite: fix race conditions in ltdl dryrun

Pavel Raiskup <[email protected]>
Newsgroups gmane.comp.gnu.libtool.patches,gmane.comp.sysutils.autoconf.general
Message-ID <[email protected]>
[+cc autoconf, as this seems to be relevant]

Hi all,

after several random [ltdl dryrun] failures, I used the 'make --debug' and
some stat calls to debug.  Logs are attached for ok & failed runs as
tarball.  Seems like after 'aclocal' run there should be an explicit
'sleep 1', similarly like in autoreconf [1].  Possible fix attached.  The
problem seems to be in autoheader and Perl's move function (underlying
utime() handling?):

   $ touch /tmp/a
   $ stat /tmp/a
     File: ‘/tmp/a’
     Size: 0               Blocks: 0          IO Block: 4096   regular empty file
   Device: 23h/35d Inode: 1296845     Links: 1
   Access: (0664/-rw-rw-r--)  Uid: ( 1000/praiskup)   Gid: ( 1000/praiskup)
   Context: unconfined_u:object_r:user_tmp_t:s0
   Access: 2014-12-15 14:03:35.744530946 +0100
   Modify: 2014-12-15 14:03:35.744530946 +0100
   Change: 2014-12-15 14:03:35.744530946 +0100
    Birth: -
   $ perl -MFile::Copy -e 'move ("/tmp/a", "a");'
   $ stat a
     File: ‘a’
     Size: 0               Blocks: 0          IO Block: 4096   regular empty file
   Device: fd00h/64768d    Inode: 11068678    Links: 1
   Access: (0664/-rw-rw-r--)  Uid: ( 1000/praiskup)   Gid: ( 1000/praiskup)
   Context: unconfined_u:object_r:user_home_t:s0
   Access: 2014-12-15 14:03:42.000000000 +0100
   Modify: 2014-12-15 14:03:35.000000000 +0100
                               ^^^ floor()-ed
   Change: 2014-12-15 14:03:42.678581581 +0100
    Birth: -

[1] http://git.savannah.gnu.org/cgit/autoconf.git/tree/bin/autoreconf.in#n356

Pavel
racy-tests.tar.gz (application/x-compressed-tar, 14.3 KB) - not displayed
0001-tests-fix-race-in-aclocal-autoheader-calls.patch (text/x-patch, 1.2 KB)
From 2ad0598f0d8cd8c8532a2c34ea1b06c71901047d Mon Sep 17 00:00:00 2001
From: Pavel Raiskup <[email protected]>
Date: Mon, 15 Dec 2014 13:42:25 +0100
Subject: [PATCH] tests: fix race in aclocal/autoheader calls

Put the sleep 1 after aclocal run, same as autoreconf does.  This
guarantees that 'aclocal.m4' will have smaller timestamp than
'config.h.in' and avoids re-running autoheader later on.

* tests/testsuite.at (LT_AT_ACLOCAL): Sleep sec after aclocal run.
---
 tests/testsuite.at | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tests/testsuite.at b/tests/testsuite.at
index 76ed722..2a359a3 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -123,6 +123,11 @@ AT_DATA([acinclude.m4],
 	  [m4_define([AC_CONFIG_MACRO_DIRS], m4_defn([AC_CONFIG_MACRO_DIR]))])
 ]])
 LT_AT_CHECK([$ACLOCAL $1$macro_dir], [0], [ignore], [ignore])
+# After the 'aclocal' run sleep 1 second to guarantee that aclocal.m4 is going
+# to have older timestamp than other autotools later-generated files (concretely
+# for libtool case, we speak about config.h.in generated autoheader).
+# Autoreconf does the same (after the first aclocal run).
+sleep 1
 AT_XFAIL_IF([test no = "$ACLOCAL"])
 AT_KEYWORDS([automake])
 ])
-- 
1.9.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.