From: stassats <sta...@us...> - 2014-01-31 18:14:31
|
The branch "master" has been updated in SBCL: via cbe0542269aa6b9dc899d901c49e2b5a36aa4f92 (commit) from 9781af76d09f6e9685b7e70e490ba86ea80b24a0 (commit) - Log ----------------------------------------------------------------- commit cbe0542269aa6b9dc899d901c49e2b5a36aa4f92 Author: Stas Boukarev <sta...@gm...> Date: Fri Jan 31 22:14:15 2014 +0400 Improve error message when loading FASLs with undefined packages. Include the symbol name when loading a FASL with a symbol from an undefined package. --- NEWS | 2 ++ src/code/fop.lisp | 27 +++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 8c931f8..fb35550 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,7 @@ ;;;; -*- coding: utf-8; fill-column: 78 -*- changes relative to sbcl-1.1.15: + * enhancement: Loading fasls with symbols from an undefined package includes + the name of the symbol in the error message. * bug fix: problems when redefining classes and doing TYPEP on classes concurrently. (lp#1272742) * bug fix: x86-64 XCHG instruction was misencoded when used with RAX, R8-R15 diff --git a/src/code/fop.lisp b/src/code/fop.lisp index f7bb13b..cb323ae 100644 --- a/src/code/fop.lisp +++ b/src/code/fop.lisp @@ -192,6 +192,12 @@ ;;;; fops for loading symbols +(defstruct (undefined-package + (:copier nil)) + error) + +(declaim (freeze-type undefined-package)) + (defun aux-fop-intern (smallp package) (declare (optimize speed)) (let* ((size (if smallp @@ -206,11 +212,17 @@ (read-string-as-unsigned-byte-32 *fasl-input-stream* buffer size) #!-sb-unicode (read-string-as-bytes *fasl-input-stream* buffer size)) - (push-fop-table (without-package-locks - (intern* buffer - size - package - :no-copy t))))) + (if (undefined-package-p package) + (error 'simple-package-error + :format-control "Error finding package for symbol ~s:~% ~a" + :format-arguments + (list (subseq buffer 0 size) + (undefined-package-error package))) + (push-fop-table (without-package-locks + (intern* buffer + size + package + :no-copy t)))))) (macrolet ((def (name code smallp package-form) `(define-fop (,name ,code) @@ -260,7 +272,10 @@ (read-string-as-bytes *fasl-input-stream* package-name) #!+sb-unicode (read-string-as-unsigned-byte-32 *fasl-input-stream* package-name)) - (push-fop-table (find-undeleted-package-or-lose package-name)))) + (push-fop-table + (handler-case (find-undeleted-package-or-lose package-name) + (simple-package-error (c) + (make-undefined-package :error (princ-to-string c))))))) ;;;; fops for loading numbers ----------------------------------------------------------------------- hooks/post-receive -- SBCL |