mainAutoconf - Support: sr #110521, autom4te does not always update...

 
 

sr #110521: autom4te does not always update cache, breaks if change happens within 1 second

Submitter:  Sergei Trofimovich <slyfox>
Submitted:  Sun 01 Aug 2021 06:55:15 PM UTC
   
 
Priority:  * 5 - Unprioritized Severity:  3 - Normal
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Operating System:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 01 Sep 2021 12:40:03 AM UTC, comment #2: 

Thanks for the bug report and fix. I installed the attached patches. The first is Andreas's fix with somewhat-different commit message; the second contains more documentation about this.

I wish Perl supported precise file timestamps but we gotta work with what we have.

(file #51848, file #51849)

Paul Eggert <eggert>
Group administrator
Sun 01 Aug 2021 08:45:22 PM UTC, comment #1: 

Please see the attached file for a possible fix using Time::HiRes.

(This raises the minimum Perl version to 5.8.)

We just started testing this patch over a wide range of packages currently in Gentoo.


(file #51726)

Andreas K. Hüttel <dilfridge>
Sun 01 Aug 2021 06:55:15 PM UTC, original submission:  

It's an upstream formward of downstream https://bugs.gentoo.org/782985 bug reported by Ionen Wolkens.

There `automake` run against outdated autoconf fails with version mismatch error. Here is full minimal reproducer:


$ cat Makefile.am
# empty



cat configure.ac
AC_INIT(bug, 0.0.0)
AM_INIT_AUTOMAKE([1.6])

AC_CONFIG_FILES([Makefile])
AC_OUTPUT



cat torture.bash
#!/bin/bash

die() {
        echo "FATAL: can't continue"
        exit 1
}

artificial_delay() {
        # https://bugs.gentoo.org/782985#c0
        [[ -n $ARTIFICIAL_DELAY ]] && sleep $ARTIFICIAL_DELAY
}

while :; do
        # remove all intermediate files from previous runs
        rm -fr -- aclocal.m4 autom4te.cache configure configure~ install-sh Makefile.in missing

        # generate aclocal and friends with older autoconf-2.69/automake-1.13
        aclocal-1.13 --force && autoconf-2.69 --force && automake-1.13 --add-missing --copy --force-missing --foreign || die

        # generate a trace (Gentoo does a bit of introspection for existing build system before a major update to new autoconf/automake)
        autoconf-2.71 --trace=AC_DOES_NOT_EXIST || die
        artificial_delay

        # a workaround
        #rm -rfv -- autom4te.cache

        # move to a new version of autoconf-2.71/automake-1.16
        aclocal-1.16 --force && /usr/bin/autoconf-2.71 --force && automake-1.16 --add-missing --copy --force-missing --foreign || die
done


The output:

bad:

+vebatim+
$ bash -x ./torture.bash
+ :
+ rm -fr -- aclocal.m4 autom4te.cache configure configure~ install-sh Makefile.in missing
+ aclocal-1.13 --force
+ autoconf-2.69 --force
aclocal.m4:17: warning: this file was generated for autoconf 2.71.
You have another version of autoconf.  It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.
+ automake-1.13 --add-missing --copy --force-missing --foreign
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
+ autoconf-2.71 --trace=AC_DOES_NOT_EXIST
+ artificial_delay
+ [[ -n '' ]]
+ aclocal-1.16 --force
+ /usr/bin/autoconf-2.71 --force
+ automake-1.16 --add-missing --copy --force-missing --foreign
configure.ac:2: error: version mismatch.  This is Automake 1.16.4,
configure.ac:2: but the definition used by this AM_INIT_AUTOMAKE
configure.ac:2: comes from Automake 1.13.4.  You should recreate
configure.ac:2: aclocal.m4 with aclocal and run automake again.
+ die
+ echo 'FATAL: can'\''t continue'
FATAL: can't continue
+ exit 1
-verbatim-

good:

+vebatim+
$ ARTIFICIAL_DELAY=1 bash -x ./torture.bash
+ :
+ rm -fr -- aclocal.m4 autom4te.cache configure configure~ install-sh Makefile.in missing
+ aclocal-1.13 --force
+ autoconf-2.69 --force
aclocal.m4:17: warning: this file was generated for autoconf 2.71.
You have another version of autoconf.  It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.
+ automake-1.13 --add-missing --copy --force-missing --foreign
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
+ autoconf-2.71 --trace=AC_DOES_NOT_EXIST
+ artificial_delay
+ [[ -n 1 ]]
+ sleep 1
+ aclocal-1.16 --force
+ /usr/bin/autoconf-2.71 --force
+ automake-1.16 --add-missing --copy --force-missing --foreign
+ :
+ rm -fr -- aclocal.m4 autom4te.cache configure configure~ install-sh Makefile.in missing
+ aclocal-1.13 --force
+ autoconf-2.69 --force
aclocal.m4:17: warning: this file was generated for autoconf 2.71.
You have another version of autoconf.  It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.
+ automake-1.13 --add-missing --copy --force-missing --foreign
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
+ autoconf-2.71 --trace=AC_DOES_NOT_EXIST
+ artificial_delay
+ [[ -n 1 ]]
+ sleep 1
+ aclocal-1.16 --force
+ /usr/bin/autoconf-2.71 --force
+ automake-1.16 --add-missing --copy --force-missing --foreign
+ :
+ rm -fr -- aclocal.m4 autom4te.cache configure configure~ install-sh Makefile.in missing
+ aclocal-1.13 --force
+ autoconf-2.69 --force
aclocal.m4:17: warning: this file was generated for autoconf 2.71.
You have another version of autoconf.  It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.
+ automake-1.13 --add-missing --copy --force-missing --foreign
configure.ac:2: installing './install-sh'
configure.ac:2: installing './missing'
+ autoconf-2.71 --trace=AC_DOES_NOT_EXIST
+ artificial_delay
+ [[ -n 1 ]]
+ sleep 1
...
-verbatim-

Explanation of `torture.bash`:

The script emulates Gentoo's behaviour of introspectinf existiong build system before safely regenerating `./configure` and all of it's depends to more recent `autoconf`/`automake`.

To do it the script runs `autoconf --trace=...` and then runs everything else.

Explanation of failure:

When `autoconf-${new} --trace=...` / `aclocal-${new}` / `automake ...` is executed within one second it tricks `autom4te` to consider traces up to date and does not regenerate traces (and breaks). `autom4te` has the following comment: 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));


`sleep 1` introduces enough delay to notice cache staleness between `autoconf-${new} --trace=...` / `aclocal-${new}`.

Thanks!

Sergei Trofimovich <slyfox>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by eggert (Updated the item)
  • -email is unavailable- added by dilfridge (Updated the item)
  • -email is unavailable- added by thesamesam (Maintainer of autoconf in Gentoo)
  • -email is unavailable- added by thesamesam
  • -email is unavailable- added by slyfox (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-09-01 eggert Attached File- Added 0001-Fix-bug-when-autom4te-updates-too-quickly.patch, #51848
        Attached File- Added 0002-Add-commentary-for-Time-HiRes-patches.patch, #51849
        StatusNone Done
        Open/ClosedOpen Closed
    2021-08-01 dilfridge Attached File- Added autoconf-2.71-time.patch, #51726
    2021-08-01 thesamesam Carbon-Copy- Added -email is unavailable-
    2021-08-01 thesamesam Carbon-Copy- Added thesamesam

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code