autoconf
[Top][All Lists]
Advanced

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

patch to invalidate Autom4te cache upon upgrade


From: Ben Pfaff
Subject: patch to invalidate Autom4te cache upon upgrade
Date: Thu, 25 May 2006 13:23:58 -0700
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

A long time ago, a Debian user filed bug #219621 (see
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=219621),
complaining that the Autom4te cache caused problems when retained
from one version to the next:

    After upgrading autoconf to 2.58 (from 2.57), suddenly running
    autoconf in a tree I was working on breaks like this:

    address@hidden:~/arch/lookupd$ autoconf
    Can't locate object method "path" via package "Request" at 
/usr/share/autoconf/Autom4te/C4che.pm line 69, <GEN1> line 112.

    This appears to be caused by the internal data structures changing
    (package Request has become Autom4te::Request), such that evaluating
    autom4te.cache/request no longer yields a valid
    @Autom4te::C4che::request array.

    The best solution is probably for autom4te to store its own version
    number in the cache, and only attempt to load it if the version
    matches.

Since then, I've been carrying along the following patch that
keeps a version number (actually a date and time) at the top of
an autom4te cache file and considers the cache invalid if the
value is not what we expect:

--- autoconf-2.59.cvs.2006.05.25.orig/bin/autom4te.in
+++ autoconf-2.59.cvs.2006.05.25/bin/autom4te.in
@@ -971,8 +984,9 @@
 # If autom4te is younger, then some structures such as C4che, might
 # have changed, which would corrupt its processing.
 Autom4te::C4che->load ($icache_file)
-  if -f $icache && mtime ($icache) > mtime ($0);
+  if -f $icache && mtime ($icache) > mtime ($0)
+                && Autom4te::C4che->good_version ($icache_file);
 
 # Add the new trace requests.
 my $req = Autom4te::C4che->request ('input' => address@hidden,
--- autoconf-2.59.cvs.2006.05.25.orig/lib/Autom4te/C4che.pm
+++ autoconf-2.59.cvs.2006.05.25/lib/Autom4te/C4che.pm
@@ -37,6 +37,8 @@
 use Carp;
 use strict;
 
+my $VERSION = 'Thu May 25 12:55:42 PDT 2006';
+
 =over 4
 
 =item @request
@@ -183,7 +185,7 @@
   $file->seek (0, 0);
   $file->truncate (0);
   print $file
-    "# This file was generated.\n",
+    "# This file was generated by Autom4te $VERSION.\n",
     "# It contains the lists of macros which have been traced.\n",
     "# It can be safely removed.\n",
     "\n",
@@ -197,7 +199,69 @@
 
 =cut
 
+#
+# GOOD_VERSION ($FILE)
+sub good_version ($$)
+{
+  my ($self, $file) = @_;
+  my ($line) = $file->getline;
+
+  return defined ($line) && scalar ($line =~ / $VERSION.$/);
+}
+
 # LOAD ($FILE)
 # ------------
 sub load ($$)

The packaging procedure replaces the version number in C4che.pm
by the current date before it installs it, using the following
command.  (This actually happens in debian/rules, which is why
I'm presenting the command instead of a patch.)

        perl -pi~ -e "s/^my \\\$$VERSION.*/my \\\$$VERSION = '`date`';/;" \
                lib/Autom4te/C4che.pm

I'd appreciate feedback whether this change, or something with
the same effect, is suitable for upstream Autoconf.
-- 
"doe not call up Any that you can not put downe."
--H. P. Lovecraft




reply via email to

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