Clojure

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

Details

  • Type: Defect Defect
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Completed
  • Affects Version/s: Release 1.5
  • Fix Version/s: Release 1.6
  • Component/s: None
  • Labels:
  • Patch:
    Code and Test
  • Approval:
    Ok

Description

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

user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
RuntimeException Reading disallowed - *read-eval* bound to :unknown  clojure.lang.Util.runtimeException (Util.java:219)

Approach: Throw explicit error stating the cause in this case.

Patch: clj-1176-source-read-eval-3.patch

Screened by: Stuart Sierra

Activity

Tim McCormack made changes -
Field Original Value New Value
Attachment 0001-CLJ-1176-Bind-read-eval-true-in-clojure.repl-source-.patch [ 11895 ]
Tim McCormack made changes -
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
clojure.repl/source is broken in Clojure 1.5.0 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

Reproduce:

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

Expected:

Source of drop-last.

Actual:

RuntimeException Reading disallowed - \*read-eval\* bound to :unknown
Andy Fingerhut made changes -
Patch Code [ 10001 ]
Stuart Halloway made changes -
Approval Triaged [ 10120 ]
Rich Hickey made changes -
Approval Triaged [ 10120 ] Vetted [ 10003 ]
Rich Hickey made changes -
Fix Version/s Release 1.6 [ 10157 ]
Gabriel Horner made changes -
Assignee Gabriel Horner [ cldwalker ]
Gabriel Horner made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Assignee Gabriel Horner [ cldwalker ]
Alex Miller made changes -
Approval Screened [ 10004 ] Vetted [ 10003 ]
Alex Miller made changes -
Labels repl
Alex Miller made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
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:

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

Expected:

Source of drop-last.

Actual:

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

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: source in this context, compiling:(NO_SOURCE_PATH:1:1)
{code}

*Approach:* Have source temporarily bind *read-eval* to true while reading so it works regardless of the actual *read-eval* state.

*Patch:* 0001-CLJ-1176-Bind-read-eval-true-in-clojure.repl-source-.patch

*Screened by:* Alex Miller - my only question is whether this is ok from a security point of view. General response from questions on clojure-dev was that this was not a concern for the clojure.repl namespace which can be disallowed in sensitive environments.
Rich Hickey made changes -
Approval Screened [ 10004 ] Incomplete [ 10006 ]
Alex Miller made changes -
Patch Code [ 10001 ] Code and Test [ 10002 ]
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Description clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: source in this context, compiling:(NO_SOURCE_PATH:1:1)
{code}

*Approach:* Have source temporarily bind *read-eval* to true while reading so it works regardless of the actual *read-eval* state.

*Patch:* 0001-CLJ-1176-Bind-read-eval-true-in-clojure.repl-source-.patch

*Screened by:* Alex Miller - my only question is whether this is ok from a security point of view. General response from questions on clojure-dev was that this was not a concern for the clojure.repl namespace which can be disallowed in sensitive environments.
clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: source in this context, compiling:(NO_SOURCE_PATH:1:1)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-2.patch

*Screened by:*
Attachment clj-1176-source-read-eval-2.patch [ 12570 ]
Stuart Sierra made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Stuart Sierra made changes -
Description clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: source in this context, compiling:(NO_SOURCE_PATH:1:1)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-2.patch

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

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: source in this context, compiling:(NO_SOURCE_PATH:1:1)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-2.patch

*Screened by:* Stuart Sierra
Stuart Sierra made changes -
Approval Screened [ 10004 ] Incomplete [ 10006 ]
Description clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: source in this context, compiling:(NO_SOURCE_PATH:1:1)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-2.patch

*Screened by:* Stuart Sierra
clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
RuntimeException Reading disallowed - *read-eval* bound to :unknown clojure.lang.Util.runtimeException (Util.java:219)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-2.patch

*Screened by:*
Alex Miller made changes -
Approval Incomplete [ 10006 ] Vetted [ 10003 ]
Description clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
RuntimeException Reading disallowed - *read-eval* bound to :unknown clojure.lang.Util.runtimeException (Util.java:219)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-2.patch

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

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
RuntimeException Reading disallowed - *read-eval* bound to :unknown clojure.lang.Util.runtimeException (Util.java:219)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-3.patch

*Screened by:*
Attachment clj-1176-source-read-eval-3.patch [ 12706 ]
Stuart Sierra made changes -
Approval Vetted [ 10003 ] Screened [ 10004 ]
Description clojure.repl/source is broken in Clojure 1.5.1 when \*read-eval\* is bound to :unknown, since source-fn reads without binding.

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
RuntimeException Reading disallowed - *read-eval* bound to :unknown clojure.lang.Util.runtimeException (Util.java:219)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-3.patch

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

{code}
user> (alter-var-root #'*read-eval* (constantly :unknown))
:unknown
user> (source drop-last)
RuntimeException Reading disallowed - *read-eval* bound to :unknown clojure.lang.Util.runtimeException (Util.java:219)
{code}

*Approach:* Throw explicit error stating the cause in this case.

*Patch:* clj-1176-source-read-eval-3.patch

*Screened by:* Stuart Sierra
Rich Hickey made changes -
Approval Screened [ 10004 ] Ok [ 10007 ]
Stuart Halloway made changes -
Resolution Completed [ 1 ]
Status Open [ 1 ] Closed [ 6 ]

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: