APROPOS with a package argument only finds present symbols, not accessible symbols

Bug #1364413 reported by Zach Beane on 2014-09-02
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

The standard says this regarding APROPOS:

    If package is non-nil, only the symbols accessible in that package
    are searched; otherwise all symbols accessible in any package are
    searched.

However, when providing a package argument to APROPOS in SBCL, it only prints symbols that are present in the given package, not symbols that are accessible.

Example:

    CL-USER> (defvar *buggalo-package* (make-package "BUGGALO" :use nil))
    *BUGGALO-PACKAGE*

    CL-USER> (defvar *buggalo-symbol* (intern "BUGGALO" *buggalo-package*))
    *BUGGALO-SYMBOL*

    CL-USER> (export (list *buggalo-symbol*) *buggalo-package*)
    T

    CL-USER> (defvar *inherits-buggalo* (make-package "BUGGALO-INHERITED"
          :use (list *buggalo-package*)))
    *INHERITS-BUGGALO*

    CL-USER> (apropos "BUGGALO" *buggalo-package*)
    BUGGALO:BUGGALO
    ; No value

    CL-USER> (apropos "BUGGALO" *inherits-buggalo*)
    ; No value

For the last command, I expected to see "BUGGALO:BUGGALO" printed. That is what is suggested by the standard and that is what happens with other implementations I tried (CLISP and CCL).

I'm using the latest SBCL.

Zach Beane (xach) wrote :

This seems potentially easy to fix, but I'm not sure what the non-standard EXTERNAL-ONLY semantics are. Does it mean "Only return symbols that are external in the provided package"? If so, I think the attached patch does the trick.

Zach Beane (xach) wrote :

Also, this isn't some idle observation. This has a practical effect on finding symbols in ASDF, which uses symbols like ASDF/FOO:BAR which are inherited and re-exported from ASDF.

Changed in sbcl:
status: New → Fix Committed
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers