<< Back to previous view

[NREPL-20] Stray "#" in session-out is breaking (.println *out*) Created: 09/Jun/12  Updated: 09/Jun/12  Resolved: 09/Jun/12

Status: Closed
Project: tools.nrepl
Component/s: None
Affects Version/s: 0.2.0
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Alex Osborne Assignee: Chas Emerick
Resolution: Completed Votes: 0
Labels: None

Patch: Code and Test
Waiting On: Chas Emerick


There's a stray "#" in clojure.tools.nrepl.middleware.session/session-out which is turning the body of the (not off) case into a lambda that's never executed:

(number? x) (.append buf (char x))
(not off) #(.append buf x) ; <----
(instance? CharSequence x) (.append buf ^CharSequence x off len)
:else (.append buf ^chars x off len))


This is causing the newline character in (.println out) and (.println err) to be lost:

user=> (with-open [conn (repl/connect :port 7888)]
(-> (repl/client conn 1000)
(repl/message {:op :eval :code "(do (.println out \"1\") (.println out \"2\") (.println out \"3\")(flush))"})
({:out "123", ;; <--- where are my "\n"s?
...}, ...)

Removing the stray "#" fixes the problem:

{:out "1\n2\n3\n",

Reported downstream by jaceklaskowski in https://github.com/technomancy/leiningen/issues/631

Patch with the trivial fix and unit test here: https://wok.meshy.org/~ato/0001-Remove-stray-hash-in-session-out-that-breaks-println-out.patch

Couldn't attach the patch to this issue as JIRA told me I don't have permission. I (Alex Osborne) have signed the Clojure CA and contribute this patch as per the terms of it.

Comment by Colin Jones [ 09/Jun/12 9:44 AM ]

Looks good, nice catch. Verified this test fails before the fix.

Chas, want me to apply/push this? I'm happy to do that, but wanted to wait since we haven't really talked about project workflow.

Comment by Chas Emerick [ 09/Jun/12 10:54 AM ]

Thank you very much — patch applied to master. I'll cut a new beta release on Monday so downstreams can pick it up.

Good eye, by the way, I'm sure I could have looked for days for that.

Generated at Sun Jan 21 11:04:05 CST 2018 using JIRA 4.4#649-r158309.