anchor.diff:           (find-global-package name))
           (t
            ;; Search local nicknames, then fall back on the global namespace.
  -         (loop
  -            for (local-nickname . actual-package) in (package-local-nicknames *package*)
  -            when (string= local-nickname name)
  -            return actual-package
  -            finally (return (find-global-package name))))))
  +         (with-package-system-lock ()
  +           (loop
  +              for (local-nickname . actual-package) in (package-local-nicknames *package*)
  +              when (string= local-nickname name)
  +              return actual-package
  +              finally (return (find-global-package name)))))))
   
   (defun find-package-or-die (name)
     (or (find-package name)
  
positive.code:   (pushnew package (package-%used-by-list package-to-use)))
  
  (defun use-package (packages-to-use &optional (package *package*))
    (let ((p (find-package-or-die package)))
      (if (listp packages-to-use)
          (dolist (use-package packages-to-use)
            (use-one-package (find-package-or-die use-package) p))
          (use-one-package (find-package-or-die packages-to-use) p)))
    t)
  
  (defun unuse-one-package (package-to-unuse package)
    (setf (package-%use-list package)
          (remove package-to-unuse (package-%use-list package)))
    (setf (package-%used-by-list package-to-unuse)
          (remove package (package-%used-by-list package-to-unuse))))
  
  (defun unuse-package (packages-to-unuse &optional (package *package*))
    (let ((package (find-package-or-die package)))
      (if (listp packages-to-unuse)
          (dolist (unuse-package packages-to-unuse)
            (unuse-one-package (find-package-or-die unuse-package) package))
          (unuse-one-package (find-package-or-die packages-to-unuse) package)))
    t)
  
  (defun make-package (package-name &key nicknames use)
    (when (find-global-package package-name)
      (error 'simple-package-error
             :package package-name
             :format-control "A package named ~S already exists."
             :format-arguments (list package-name)))
    (dolist (n nicknames)
      (when (find-global-package n)
        (error 'simple-package-error
               :package n
               :format-control "A package named ~S already exists."
               :format-arguments (list n))))
    (let ((use-list (mapcar 'find-package use))
          (package (%make-package (string package-name)
                                  (mapcar (lambda (x) (string x)) nicknames))))
      ;; Use packages.
      (use-package use-list package)
      ;; Install the package in the package registry.
      (push (cons (package-name package) package) *package-list*)
      (dolist (s (package-nicknames package))
        (push (cons s package) *package-list*))
      package))
  
  (defun find-symbol (string &optional (package *package*))
    (check-type string string)
    (let ((p (find-package-or-die package)))
      (multiple-value-bind (sym present-p)
          (gethash string (package-%internal-symbols p))
        (when present-p
          (return-from find-symbol (values sym :internal))))
      (multiple-value-bind (sym present-p)
          (gethash string (package-%external-symbols p))
        (when present-p
          (return-from find-symbol (values sym :external))))
      (let ((pending (remove-duplicates (package-use-list p)))
            (visited '()))
        (loop
           (when (endp pending)
             (return (values nil nil)))
           (let ((pak (pop pending)))
             (when (not (member pak visited))
               (push pak visited)
               (multiple-value-bind (sym present-p)
                   (gethash string (package-%external-symbols pak))
                 (when present-p
                   (return (values sym :inherited))))
               (dolist (subpak (package-use-list pak))
                 (pushnew subpak pending))))))))
  
  (defun import-one-symbol (symbol package)
    ;; Check for a conflicting symbol.
    (multiple-value-bind (existing-symbol existing-mode)
        (find-symbol (symbol-name symbol) package)
  
negative.code:   t)
  
  (defun unexport (symbols &optional (package *package*))
    (with-package-system-lock ()
      (let ((p (find-package-or-die package)))
        (if (listp symbols)
            (dolist (s symbols)
              (unexport-one-symbol s p))
            (unexport-one-symbol symbols p))))
    t)
  
  (defun unintern (symbol &optional (package *package*))
    (check-type symbol symbol)
    (with-package-system-lock ()
      (setf package (find-package-or-die package))
      (when (eql (symbol-package symbol) package)
        (setf (symbol-package symbol) nil))
      (let ((removed-symbol-p nil))
        (multiple-value-bind (existing-internal-symbol internal-symbol-presentp)
            (gethash (symbol-name symbol) (package-%internal-symbols package))
          (when (and internal-symbol-presentp (eql existing-internal-symbol symbol))
            (setf removed-symbol-p t)
            (remhash (symbol-name symbol) (package-%internal-symbols package))))
        (multiple-value-bind (existing-external-symbol external-symbol-presentp)
            (gethash (symbol-name symbol) (package-%external-symbols package))
          (when (and external-symbol-presentp (eql existing-external-symbol symbol))
            (setf removed-symbol-p t)
            (remhash (symbol-name symbol) (package-%external-symbols package))))
        (setf (package-%shadowing-symbols package) (remove symbol (package-%shadowing-symbols package)))
        removed-symbol-p)))
  
  (defun make-package-iterator-find-symbols (package symbol-types)
    "Find all the symbols in PACKAGE that match SYMBOL-TYPES."
    (with-package-system-lock ()
      (let ((symbols '()))
        (when (member :internal symbol-types)
          (maphash (lambda (k v)
                     (declare (ignore k))
                     (push (cons v :internal) symbols))
                   (package-%internal-symbols package)))
        (when (member :external symbol-types)
          (maphash (lambda (k v)
                     (declare (ignore k))
                     (push (cons v :external) symbols))
                   (package-%external-symbols package)))
        (when (member :inherited symbol-types)
          (dolist (p (package-use-list package))
            (maphash (lambda (k v)
                       (declare (ignore k))
                       (push (cons v :inherited) symbols))
                     (package-%external-symbols p))))
        symbols)))
  
  (defun make-package-iterator (package-list symbol-types)
    ;; Listify PACKAGE-LIST.
  