anchor.diff:    (setf (gethash (symbol-name symbol) (package-%external-symbols package)) symbol))
   
   (defun export (symbols &optional (package *package*))
  -  (let ((p (find-package-or-die package)))
  -    (if (listp symbols)
  -        (dolist (s symbols)
  -          (export-one-symbol s p))
  -        (export-one-symbol symbols p)))
  +  (with-package-system-lock ()
  +    (let ((p (find-package-or-die package)))
  +      (if (listp symbols)
  +          (dolist (s symbols)
  +            (export-one-symbol s p))
  +          (export-one-symbol symbols p))))
     t)
   
   (defun unexport-one-symbol (symbol package)
  +  (check-package-system-lock-held)
     (let* ((name (symbol-name symbol)))
       (multiple-value-bind (sym mode)
           (find-symbol name package)
  
positive.code:       (setf (symbol-package symbol) package))))
  
  (defun import (symbols &optional (package *package*))
    (let ((p (find-package-or-die package)))
      (if (listp symbols)
          (dolist (s symbols)
            (import-one-symbol s p))
          (import-one-symbol symbols p)))
    t)
  
  (defun export-one-symbol (symbol package)
    (dolist (q (package-used-by-list package))
      (multiple-value-bind (other-symbol status)
          (find-symbol (symbol-name symbol) q)
  
negative.code:   (package-%locally-nicknamed-by-list (find-package-or-die package)))
  
  (defun add-package-local-nickname (local-nickname actual-package &optional (package *package*))
    (with-package-system-lock ()
      (let ((local-nickname (string local-nickname))
            (actual-package (find-global-package-or-die actual-package)))
        (when (member local-nickname '("CL" "COMMON-LISP" "KEYWORD") :test #'string=)
          (error "New package local nickname ~S conflicts with standard CL package." local-nickname))
        (let ((existing (assoc local-nickname (package-local-nicknames package) :test #'string=)))
          (cond ((not existing)
                 (push (cons local-nickname actual-package) (package-%local-nickname-list package))
                 (pushnew package (package-%locally-nicknamed-by-list actual-package)))
                ((not (eql actual-package (cdr existing)))
                 (cerror "Replace it" "New local nickname ~S for package ~S conflicts with existing nickname for package ~S."
                         local-nickname actual-package (cdr existing))
                 (remove-package-local-nickname local-nickname package)
                 (push (cons local-nickname actual-package) (package-%local-nickname-list package))
                 (pushnew package (package-%locally-nicknamed-by-list actual-package)))))))
    package)
  
  (defun remove-package-local-nickname (local-nickname &optional (package *package*))
    (with-package-system-lock ()
      (let* ((existing (assoc local-nickname (package-%local-nickname-list package) :test #'string=)))
        (when existing
          (let ((other-package (cdr existing)))
            (setf (package-%local-nickname-list package) (remove local-nickname (package-%local-nickname-list package)
                                                                 :test #'string= :key #'car))
            (when (zerop (count other-package (package-%local-nickname-list package)
                                :key #'cdr))
              (setf (package-%locally-nicknamed-by-list other-package) (remove package (package-%locally-nicknamed-by-list other-package)))))
          t))))
  
  (defun initialize-package-system ()
    (write-line "Initializing package system.")
    (with-package-system-lock ()
      ;; Create the core packages.
      (setf *package-list* '())
      (setf *keyword-package* (make-package "KEYWORD"))
      (make-package "COMMON-LISP" :nicknames '("CL"))
      (make-package "COMMON-LISP-USER" :nicknames '("CL-USER") :use '("CL"))
      (setf *package* (make-package "MEZZANO.INTERNALS" :use '("CL")))
      ;; Now import all the symbols.
      (dotimes (i (length *initial-obarray*))
        (let ((sym (aref *initial-obarray* i)))
          (let* ((package-keyword (symbol-package sym))
                 (package (find-package (string package-keyword))))
            (when (not package)
              (setf package (make-package (string package-keyword) :use '("CL"))))
            (setf (symbol-package sym) nil)
            (import-one-symbol sym package)
            (when (member package-keyword '(:common-lisp :keyword))
              (export-one-symbol sym package))))))
    (values))
  