• Francois-Rene Rideau's avatar
    Fix upgrade issue with asdf/bundle. · 8e68ac22
    Francois-Rene Rideau authored
    Change implementation strategy for operation metadata methods
    bundle-type, gather-operation and gather-type.
    Upgrading from 3.1.7 or earlier yielded incorrect values for the metadata slots
    of the bundle operation classes, e.g.
    (gather-type (make-operation 'monolithic-lib-op))) was stuck to :STATIC-LIBRARY
    instead of its correct value :OBJECT since 3.2.0.
    The reason was that we were storing the value for this method in the :initform
    for the slot gather-type, which started as clever way of defining it as part of
    the DEFCLASS form for the class itself; however, this usage pattern does not
    work well with hot code upgrade: if the :initform changes during ASDF upgrade,
    the slot is already initialized, so its value isn't updated. That would require
    a method on UPDATE-INSTANCE-FOR-REDEFINED-CLASS, which hopefully should be
    invoked despite the fact that the shape of the class hasn't changed.
    A new slot won't be allocated because (a) we ensure that our operation classes
    are singleton classes using an *operations* cache, so objects are not
    reallocated, and (b) we define our slots with an :allocation :class, anyway.
    Remarkably, at least *some* of our changes in :initform have worked anyway,
    because when we transitioned allocation from :instance (default) to :class,
    that transition did force the computation of the new :initform, so the problem
    was hidden. But we're already out of luck with this upgrade from 3.1.7,
    and we must find a real solution.
    The Right Thing(tm) to do is to use DEFMETHOD to define specialized values.
    This commit does exactly that for the slots defined in bundle.lisp
    (and also used in concatenate-source.lisp). Ideally, we'd also do that
    for the slots defined in action.lisp and used in lisp-action.lisp, bundle.lisp
    and concatenate-source.lisp --- but there might or might not be clients
    in Quicklisp (or beyond Quicklisp) that this change would break.
    We must check backward compatibility, make sufficient announcement, etc. Sigh.
concatenate-source.lisp 5.66 KB