Clojure

clojure.repl/source fails when *read-eval* bound to :unknown

Details

  • Type: Defect Defect
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • Affects Version/s: Release 1.5
  • Fix Version/s: Release 1.6
  • Component/s: None
  • Labels:
    None
  • Patch:
    Code
  • Approval:
    Vetted

Description

clojure.repl/source is broken in Clojure 1.5.0 when *read-eval* is bound to :unknown, since source-fn reads without binding.

Reproduce:

  1. Either set
    :jvm-opts ["-Dclojure.read.eval=unknown"]
    in Leiningen or eval at REPL:
    (alter-var-root #'*read-eval* (constantly :unknown))
  2. (use 'clojure.repl)
  3. (source drop-last)

Expected:

Source of drop-last.

Actual:

RuntimeException Reading disallowed - *read-eval* bound to :unknown

Activity

Hide
Tim McCormack added a comment -

The attached patch just binds *read-eval* to true inside source-fn.

Show
Tim McCormack added a comment - The attached patch just binds *read-eval* to true inside source-fn.
Hide
Stuart Halloway added a comment -

Note: Allowing this implies that you trust the data on your classpath. If there are reasons somebody might not, we should reject this patch and people will have to be explicit when calling source.

Show
Stuart Halloway added a comment - Note: Allowing this implies that you trust the data on your classpath. If there are reasons somebody might not, we should reject this patch and people will have to be explicit when calling source.
Hide
Tim McCormack added a comment -

Ugh, that's a fair point when it comes to sandboxing. I'll check with the owners of clojurebot and lazybot.

Show
Tim McCormack added a comment - Ugh, that's a fair point when it comes to sandboxing. I'll check with the owners of clojurebot and lazybot.
Hide
Tim McCormack added a comment -

I haven't come up with any scenarios where this is problematic, and I haven't heard anything back from the bot owners. As for sandboxing, clojure.repl can easily be excluded.

Show
Tim McCormack added a comment - I haven't come up with any scenarios where this is problematic, and I haven't heard anything back from the bot owners. As for sandboxing, clojure.repl can easily be excluded.

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated: