Fork me on GitHub
#sci
<
2022-05-15
>
borkdude10:05:33

@devn I've got a fix underway for print-method - while fixing another issue I found a better way to do it. And by default print-method in SCI will throw when used with a direction on how to make it work when you don't need sandboxing.

👍 1
borkdude10:05:06

I think that would be the cleanest option, it will make SCI safer by default, while breaking current users but the error should guide them to an easy fix

borkdude12:05:33

Merged to master now

devn19:05:28

beautiful. thanks!

devn19:05:18

@borkdude haven’t reviewed the commit yet, but is print-dup going to get the same treatment?

devn19:05:43

ah looks like this is just print-method, either way i’m just adding print-method and print-dup to my :deny list for now

borkdude19:05:30

@devn Now did the same for print-dup

borkdude19:05:05

Thanks for uncovering these things with http://getclojure.org :)

devn19:05:53

my pleasure! btw, took your observation and removed things returning #object, though not everywhere as there are cases of (#object[…] #object[...] :foo)

devn19:05:03

need to update the index in prod

borkdude19:05:26

also things returning functions, or does that fall into that category?

devn19:05:05

same category yeah, hence all of my confusion relating to the pretty printing in cider nrepl

devn19:05:03

i was trying to remove things starting with "#function" and getting strange results

devn21:05:15

i now have a new mystery that is frying my brain 😕 I don’t think it’s SCI-related, but: "(-> 1 inc inc inc inc inc)" => "(#object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"] (#object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"] (#object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"] #object[clojure.core$inc 0x3d328cd6 \"clojure.core$inc@3d328cd6\"])))" meanwhile (-> 3 inc inc inc) => 6

borkdude21:05:40

$ bb -e '(-> 1 inc inc inc inc inc)'
6
Seems normal in SCI

borkdude21:05:40

are you doing a manual macroexpand or so?

devn21:05:09

i don’t believe im engaging in any funny business like that, no. https://github.com/devn/getclojure/blob/main/src/getclojure/sexp.clj#L36 of course, I can’t reproduce in the REPL, only when running the full input set which takes about 20min. when i look at the raw strings that make it into elasticsearch, they look completely fine

borkdude21:05:57

Perhaps some re-definition of -> which should not be possible by default

devn21:05:10

yeah i’ve been scouring looking for something like that

devn22:05:37

boom, found it

devn22:05:41

(alter-meta! #'-> dissoc :macro)

devn22:05:46

(sci/eval-string "(-> 1 inc inc)") ;; => 3
(sci/eval-string "(alter-meta! #'-> dissoc :macro)") ;; => nil
(sci/eval-string "(-> 1 inc inc)") ;; => #function[clojure.core/inc]

devn01:05:12

I am thinking of automating finding situations like this by running every single expression in the sandbox after every single other expression in SCI.

borkdude05:05:52

Thanks, good catch!

borkdude07:05:22

Fixed

❤️ 1