Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 782985 - [TRACKER] >=sys-devel/autoconf-2.70 race condition issues (Failed Running Automake - error: version mismatch. This is Automake 1.16.3)
Summary: [TRACKER] >=sys-devel/autoconf-2.70 race condition issues (Failed Running Aut...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL: https://savannah.gnu.org/support/inde...
Whiteboard: Patch applied in Gentoo.
Keywords: Tracker
Depends on: 775725 775758 775911 775926 775950 776172 776301 776304 776622 776625 776634 776658 776826 776829 776844 777027 777030 777156 777168 777171 777315 777357 777378 777384 777387 777501 777504 777753 805587
Blocks: autoconf-2.7x
  Show dependency tree
 
Reported: 2021-04-15 08:03 UTC by Ionen Wolkens
Modified: 2021-11-22 11:54 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
autoconf-2.71-always-stale.patch (autoconf-2.71-always-stale.patch,191 bytes, patch)
2021-08-01 13:45 UTC, Sergei Trofimovich (RETIRED)
Details | Diff
patch for higher time resolution (0001-Use-stat-from-Time-HiRes-instead-of-File-stat.patch,933 bytes, patch)
2021-08-01 17:09 UTC, Andreas K. Hüttel
Details | Diff
patch for higher time resolution (autoconf-2.71-time.patch,1.22 KB, patch)
2021-08-01 17:23 UTC, Andreas K. Hüttel
Details | Diff
0001-profiles-package.mask-a-add-a-bug-reference-to-autoc.patch (0001-profiles-package.mask-a-add-a-bug-reference-to-autoc.patch,1.14 KB, patch)
2021-08-01 18:32 UTC, Sergei Trofimovich (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ionen Wolkens gentoo-dev 2021-04-15 08:03:17 UTC
autoconf-2.7x introduced a race condition with how it's used by autotools.eclass.

Error happens at the automake stage, and automake.out will have one of:

    configure.ac:4: error: version mismatch.  This is Automake 1.16.3,
or
    configure.ac:5: error: your implementation of AM_INIT_AUTOMAKE comes from an
    configure.ac:5: old Automake version.  You should recreate aclocal.m4

Not believed individual packages need their own fix, this tracker is
for reference.

Known to be easier to reproduce on a CPU with good single-thread/boost
performance, for some hardware it may be near-impossible to reproduce.

To reproduce without the eclass, autom4te.cache left by the eclass
autotools_check_macro()'s --trace usage is needed. For example, looping
this on a clean affected source (e.g. x11-misc/numlockx) may fail
eventually:

autoconf --trace=AC_INIT && \
    aclocal && autoconf -f && autoheader && automake -acf --foreign

Not known to happen with autoreconf after a --trace.
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2021-08-01 13:45:34 UTC
I think it's not exactly a race condition (i found no processes running in parallel), but a bug in too coarse grained timestamps used to regenerate the autoconf cache.

I looked at xmlto's failures and noticed that failure happens when automake decides not to regenerate caches because they are too fresh.

autoconf's comment for `up_to_date()` function nails it down:

https://git.savannah.gnu.org/cgit/autoconf.git/tree/bin/autom4te.in#n913

  # The youngest of the cache files must be older than the oldest of
  # the dependencies.
  # FIXME: These timestamps have only 1-second resolution.
  # Time::HiRes fixes this, but assumes Perl 5.8 or later.
  my $tmtime = mtime ($tfile);
  my $omtime = mtime ($ofile);
  my ($file, $mtime) = ($tmtime < $omtime
			? ($ofile, $omtime) : ($tfile, $tmtime));

Note that it uses single-second resolution for that.

If the machine is fast enough to unpack the source and run all the autoconf steps within a second it will not regenerate stale traces.

The following workaround seems to repair `xmlto` for me, but I think it's too conservative for general use:

--- a/bin/autom4te.in
+++ b/bin/autom4te.in
@@ -898,6 +898,8 @@ sub up_to_date ($)
 {
   my ($req) = @_;

+  return 0;
+
   return 0
     if ! $req->valid;
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2021-08-01 13:45:57 UTC
Created attachment 729279 [details, diff]
autoconf-2.71-always-stale.patch
Comment 3 Andreas K. Hüttel archtester gentoo-dev 2021-08-01 17:09:42 UTC
Created attachment 729375 [details, diff]
patch for higher time resolution

Here's a patch that works from ~ Perl 5.8 on and provides us time resolution.

Completely untested so far, please give it a try.
Comment 4 Andreas K. Hüttel archtester gentoo-dev 2021-08-01 17:18:53 UTC
(In reply to Andreas K. Hüttel from comment #3)
> Created attachment 729375 [details, diff] [details, diff]
> patch for higher time resolution
> 
> Here's a patch that works from ~ Perl 5.8 on and provides us time resolution.
> 
> Completely untested so far, please give it a try.

Doesnt work yet. On it.
Comment 5 Andreas K. Hüttel archtester gentoo-dev 2021-08-01 17:23:52 UTC
Created attachment 729402 [details, diff]
patch for higher time resolution

this one is actually working perl :D
Comment 6 Andreas K. Hüttel archtester gentoo-dev 2021-08-01 18:02:27 UTC
(In reply to Andreas K. Hüttel from comment #5)
> Created attachment 729402 [details, diff] [details, diff]
> patch for higher time resolution
> 
> this one is actually working perl :D

... and the testsuite passes with the patch. :)
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2021-08-01 18:32:17 UTC
Created attachment 729423 [details, diff]
0001-profiles-package.mask-a-add-a-bug-reference-to-autoc.patch
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2021-08-01 18:56:17 UTC
Filed bug and minimal reproducer upstream as https://savannah.gnu.org/support/index.php?110521
Comment 9 Larry the Git Cow gentoo-dev 2021-08-01 19:44:35 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a27bb196930c2b32f3f24956d902c2849d27d20b

commit a27bb196930c2b32f3f24956d902c2849d27d20b
Author:     Andreas K. Hüttel <dilfridge@gentoo.org>
AuthorDate: 2021-08-01 19:44:14 +0000
Commit:     Andreas K. Hüttel <dilfridge@gentoo.org>
CommitDate: 2021-08-01 19:44:24 +0000

    sys-devel/autoconf: use Time::HiRes functions, bug 782985
    
    While this solution is perfect for Gentoo, it may not be upstreamable
    (since Time::HiRes was introduced in Perl 5.8 and autoconf upstream
    insists on supporting Perl 5.6).
    
    Bug: https://bugs.gentoo.org/782985
    Package-Manager: Portage-3.0.20, Repoman-3.0.3
    Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>

 sys-devel/autoconf/autoconf-2.71.ebuild           |  2 +
 sys-devel/autoconf/files/autoconf-2.71-time.patch | 49 +++++++++++++++++++++++
 2 files changed, 51 insertions(+)
Comment 10 Larry the Git Cow gentoo-dev 2021-08-01 19:47:28 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=e9c4fccc1d664d80c422c0e1eea169564266fb5c

commit e9c4fccc1d664d80c422c0e1eea169564266fb5c
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2021-08-01 16:36:54 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-08-01 19:47:12 +0000

    profiles/package.mask: add a bug reference to autoconf:2.71 mask
    
    Bug: https://bugs.gentoo.org/782985
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/package.mask | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
Comment 11 Larry the Git Cow gentoo-dev 2021-08-01 19:51:31 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=92fbfd818f07358491803f0b2ca4ec63296d4360

commit 92fbfd818f07358491803f0b2ca4ec63296d4360
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-08-01 19:51:08 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-08-01 19:51:24 +0000

    sys-devel/autoconf: revbump for possible 2.71 race condition fix
    
    See: a27bb196930c2b32f3f24956d902c2849d27d20b
    Bug: https://bugs.gentoo.org/782985
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-devel/autoconf/{autoconf-2.71.ebuild => autoconf-2.71-r1.ebuild} | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
Comment 12 Larry the Git Cow gentoo-dev 2021-08-03 13:00:13 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0bedc7744b5b77113a27ac257053c24999610b26

commit 0bedc7744b5b77113a27ac257053c24999610b26
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2021-08-03 12:57:37 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2021-08-03 12:57:37 +0000

    profiles: unmask autoconf 2.71
    
    Let's give it another go. It was rather hard last time
    around to see many actual problems with 2.71 at all,
    and we've since fixed all remaining known ones other
    than some which look rather stale.
    
    We'll revisit if necessary.
    
    Bug: https://bugs.gentoo.org/732648
    Bug: https://bugs.gentoo.org/782985
    Signed-off-by: Sam James <sam@gentoo.org>

 profiles/package.mask | 6 ------
 1 file changed, 6 deletions(-)