anchor.diff:      ;; To avoid infinite recursion in cases where you defsystem a system
       ;; that is registered to a different location to find-system,
       ;; we also need to remember it in the asdf-cache.
  -    (with-asdf-cache ()
  -      (let* ((name (coerce-name name))
  -             (source-file (if sfp source-file (resolve-symlinks* (load-pathname))))
  -             (registered (system-registered-p name))
  -             (registered! (if registered
  -                              (rplaca registered (get-file-stamp source-file))
  -                              (register-system
  -                               (make-instance 'system :name name :source-file source-file))))
  -             (system (reset-system (cdr registered!)
  -                                   :name name :source-file source-file))
  -             (component-options
  -              (remove-plist-keys '(:defsystem-depends-on :class) options))
  -             (defsystem-dependencies (loop :for spec :in defsystem-depends-on
  -                                           :when (resolve-dependency-spec nil spec)
  -                                           :collect :it)))
  -        ;; cache defsystem-depends-on in canonical form
  -        (when defsystem-depends-on
  -          (setf component-options
  -                (append `(:defsystem-depends-on ,(parse-dependency-defs defsystem-depends-on))
  -                        component-options)))
  -        (set-asdf-cache-entry `(find-system ,name) (list system))
  -        (load-systems* defsystem-dependencies)
  -        ;; We change-class AFTER we loaded the defsystem-depends-on
  -        ;; since the class might be defined as part of those.
  -        (let ((class (class-for-type nil class)))
  -          (unless (subtypep class 'system)
  -            (error 'non-system-system :name name :class-name (class-name class)))
  -          (unless (eq (type-of system) class)
  -            (change-class system class)))
  -        (parse-component-form
  -         nil (list*
  -              :module name
  -              :pathname (determine-system-directory pathname)
  -              component-options)))))
  +    (nest
  +     (with-asdf-session ())
  +     (let* ((name (coerce-name name))
  +            (source-file (if sfp source-file (resolve-symlinks* (load-pathname))))))
  +     (flet ((fix-case (x) (if (logical-pathname-p source-file) (string-downcase x) x))))
  +     (let* ((asd-name (and source-file
  +                           (equal "asd" (fix-case (pathname-type source-file)))
  +                           (fix-case (pathname-name source-file))))
  +            ;; note that PRIMARY-NAME is a *syntactically* primary name
  +            (primary-name (primary-system-name name)))
  +       (when (and asd-name
  +                  (not (equal asd-name primary-name))
  +                  (not (known-system-with-bad-secondary-system-names-p asd-name)))
  +         (warn (make-condition 'bad-system-name :source-file source-file :name name))))
  +     (let* (;; NB: handle defsystem-depends-on BEFORE to create the system object,
  +            ;; so that in case it fails, there is no incomplete object polluting the build.
  +            (checked-defsystem-depends-on
  +             (let* ((dep-forms (parse-dependency-defs defsystem-depends-on))
  +                    (deps (loop :for spec :in dep-forms
  +                            :when (resolve-dependency-spec nil spec)
  +                            :collect :it)))
  +               (load-systems* deps)
  +               dep-forms))
  +            (system (or (find-system-if-being-defined name)
  +                        (if-let (registered (registered-system name))
  +                          (reset-system-class registered 'undefined-system
  +                                              :name name :source-file source-file)
  +                          (register-system (make-instance 'undefined-system
  +                                                          :name name :source-file source-file)))))
  +            (component-options
  +             (append
  +              (remove-plist-keys '(:defsystem-depends-on :class) options)
  +              ;; cache defsystem-depends-on in canonical form
  +              (when checked-defsystem-depends-on
  +                `(:defsystem-depends-on ,checked-defsystem-depends-on))))
  +            (directory (determine-system-directory pathname)))
  +       ;; This works hand in hand with asdf/find-system:find-system-if-being-defined:
  +       (set-asdf-cache-entry `(find-system ,name) (list system)))
  +     ;; We change-class AFTER we loaded the defsystem-depends-on
  +     ;; since the class might be defined as part of those.
  +     (let ((class (class-for-type nil class)))
  +       (unless (subtypep class 'system)
  +         (error 'non-system-system :name name :class-name (class-name class)))
  +       (unless (eq (type-of system) class)
  +         (reset-system-class system class)))
  +     (parse-component-form nil (list* :module name :pathname directory component-options))))
   
     (defmacro defsystem (name &body options)
       `(apply 'register-system-definition ',name ',options)))
  
positive.code: implementation's MAKE-PATHNAME and other primitives to a CLHS-standard format
  that is a list and not a string."
      (cond
        #-(or cmu sbcl scl) ;; these implementations already normalize directory components.
        ((stringp directory) `(:absolute ,directory))
        ((or (null directory)
             (and (consp directory) (member (first directory) '(:absolute :relative))))
  
negative.code:                (cond
                   (exit `(,exit :code code :abort (not finish-output)))
                   (quit `(,quit :unix-status code :recklessly-p (not finish-output)))))
      #-(or abcl allegro clasp clisp clozure cmucl ecl gcl genera lispworks mcl mkcl sbcl scl xcl)
      (not-implemented-error 'quit "(called with exit code ~S)" code))
  
    (defun die (code format &rest arguments)
      "Die in error with some error message"
  