replikativ / geheimnis

Cross-platform cryptography between cljs and clj.
Eclipse Public License 1.0
35 stars 2 forks source link

Library breaks build with cljs 1.9.473 #1

Closed FossiFoo closed 7 years ago

FossiFoo commented 7 years ago

after getting no output on upgrading to 1.9.473, i tracked the issue down to this library.

if i build including it (at least with boot), the js doesn't get written: boot -d adzerk/boot-cljs:1.7.228-2 -d org.clojure/clojurescript:1.9.473 -d io.replikativ/geheimnis:0.1.0 -BP -s foo cljs target

with "foo" being a simple core.cljs not even requiring the package

it seems like it fundamentaly breaks something in cljs without causing an error

i posted on clojurians.slack.com in #clojurescript and will update if i get any reply.

FossiFoo commented 7 years ago

I've made a small poc at https://github.com/FossiFoo/cljs-compile-poc

I included a lein build that throws an error:

Compiling ClojureScript... Compiling "target/client.js" from ["src"]... Compiling "target/client.js" failed. clojure.lang.ExceptionInfo: Not a valid data-reader map {:url #object[java.net.URL 0x4e481512 "jar:file:/home/fossi/.m2/repository/io/replikativ/geheimnis/0.1.0/geheimnis-0.1.0.jar!/data_readers.cljc"]} at clojure.core$ex_info.invokeStatic(core.clj:4725) at clojure.core$ex_info.invoke(core.clj:4725) at cljs.closure$load_data_reader_file.invokeStatic(closure.clj:2018) at cljs.closure$load_data_reader_file.invoke(closure.clj:2013) at clojure.core.protocols$fn9143.invokeStatic(protocols.clj:167) at clojure.core.protocols$fn9143.invoke(protocols.clj:124) at clojure.core.protocols$fn9098$G90939107.invoke(protocols.clj:19) at clojure.core.protocols$seq_reduce.invokeStatic(protocols.clj:31) at clojure.core.protocols$fn9124.invokeStatic(protocols.clj:75) at clojure.core.protocols$fn9124.invoke(protocols.clj:75) at clojure.core.protocols$fn9072$G90679085.invoke(protocols.clj:13) at clojure.core$reduce.invokeStatic(core.clj:6704) at clojure.core$reduce.invoke(core.clj:6686) at cljs.closure$get_data_readersSTAR.invokeStatic(closure.clj:2043) at cljs.closure$get_data_readersSTAR.invoke(closure.clj:2036) at cljs.closure$get_data_readersSTAR.invokeStatic(closure.clj:2040) at cljs.closure$get_data_readersSTAR.invoke(closure.clj:2036) at clojure.lang.AFn.applyToHelper(AFn.java:152) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.core$apply.invokeStatic(core.clj:657) at clojure.core$memoize$fn7884.doInvoke(core.clj:6235) at clojure.lang.RestFn.invoke(RestFn.java:397) at cljs.closure$load_data_readersBANG.invokeStatic(closure.clj:2048) at cljs.closure$load_data_readersBANG.invoke(closure.clj:2047) at cljs.closure$build.invokeStatic(closure.clj:2116) at cljs.closure$build.invoke(closure.clj:2055) at cljs.build.api$build.invokeStatic(api.clj:206) at cljs.build.api$build.invoke(api.clj:193) at cljs.build.api$build.invokeStatic(api.clj:196) at cljs.build.api$build.invoke(api.clj:193) at cljsbuild.compiler$compile_cljs$fn7014.invoke(compiler.clj:60) at cljsbuild.compiler$compile_cljs.invokeStatic(compiler.clj:59) at cljsbuild.compiler$compile_cljs.invoke(compiler.clj:48) at cljsbuild.compiler$run_compiler.invokeStatic(compiler.clj:168) at cljsbuild.compiler$run_compiler.invoke(compiler.clj:122) at user$eval7169$iter72177221$fn7222$fn7248.invoke(form-init1253039633183074797.clj:1) at user$eval7169$iter72177221$fn7222.invoke(form-init1253039633183074797.clj:1) at clojure.lang.LazySeq.sval(LazySeq.java:40) at clojure.lang.LazySeq.seq(LazySeq.java:49) at clojure.lang.RT.seq(RT.java:525) at clojure.core$seq6422.invokeStatic(core.clj:137) at clojure.core$dorun.invokeStatic(core.clj:3106) at clojure.core$doall.invokeStatic(core.clj:3121) at clojure.core$doall.invoke(core.clj:3121) at user$eval7169.invokeStatic(form-init1253039633183074797.clj:1) at user$eval7169.invoke(form-init1253039633183074797.clj:1) at clojure.lang.Compiler.eval(Compiler.java:6978) at clojure.lang.Compiler.eval(Compiler.java:6968) at clojure.lang.Compiler.load(Compiler.java:7430) at clojure.lang.Compiler.loadFile(Compiler.java:7368) at clojure.main$load_script.invokeStatic(main.clj:277) at clojure.main$init_opt.invokeStatic(main.clj:279) at clojure.main$init_opt.invoke(main.clj:279) at clojure.main$initialize.invokeStatic(main.clj:310) at clojure.main$null_opt.invokeStatic(main.clj:344) at clojure.main$null_opt.invoke(main.clj:341) at clojure.main$main.invokeStatic(main.clj:423) at clojure.main$main.doInvoke(main.clj:386) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.Var.applyTo(Var.java:700) at clojure.main.main(main.java:37) Subprocess failed

FossiFoo commented 7 years ago

the new version of boot-cljs also displays the above error. i also can't see data_readers.cljc in this repo, so the published snapshot seems broken.

whilo commented 7 years ago

I have checked it, it is in the jar file on clojars. The file is here: https://github.com/replikativ/geheimnis/blob/master/resources/data_readers.cljc

I am not sure whether this data_readers approach is really a good thing, but it might be interesting to know whether boot can deal with it in general. Maybe you can try in your own project with a simple example?

deg commented 7 years ago

Looks like the boot non-reporting problem has been fixed, I guess. But, my project is lein-based, and I'm hitting the Not a valid data-reader map errror, trying to use this library. Any workaround known?

whilo commented 7 years ago

@deg The data readers are here: https://github.com/replikativ/geheimnis/blob/master/resources/data_readers.cljc Maybe you need to put them into your resources file? I can try to fix my leiningen project file, still investigating options.

whilo commented 7 years ago

@deg Can you try https://github.com/replikativ/geheimnis/commit/c063a5bc030a0c1afac6814f6caf0311d0f5f3bd ? I have moved the readers into the src folder, which hopefully lands on your classpath as well.

deg commented 7 years ago

Hmm, partial success.

It looks like I've made it past the reader error, but I've hit another problem.

My project is in ClojureScript and I'm using the AES portion of your library.

I get an error:

No such namespace: goog.crypt.Pkcs7, could not locate goog/crypt/Pkcs7.cljs, goog/crypt/Pkcs7.cljc, or Closure namespace "goog.crypt.Pkcs7"

Do I need to explicitly include something?

I think I've done all the steps called for in your readme:

project.clj:

...
[io.replikativ/geheimnis "0.1.0"]  ;; Local install
...

my-file.cljs:

...
  (:require  ...
             [geheimnis.aes :refer [encrypt decrypt]]
...
(encrypt "whatever")
whilo commented 7 years ago

This is provided in geheimnis' project.clj by :libs ["gclosure/pkcs7.js"]. I am checking.

whilo commented 7 years ago

I can reproduce the issue, I am sorry you are affected and I haven't checked geheimnis better yet. It is the most unfinished of all replikativ libraries. I still haven't found a better compact solution, so I'll try to fix it.

whilo commented 7 years ago

@deg It should be fixed with version 0.1.1 now. May I ask what you are building with it? :)

deg commented 7 years ago

Thanks, this new version works! (and sorry for my delay; I was distracted by other projects this week)

I'm using this for a toy project where I want to shroud strings to the same value in both Clojure and ClojureScript.

whilo commented 7 years ago

Great! I will close this issue for now. Feel free to open a new one, if something fails. :)

whilo commented 7 years ago

Great! I will close this issue for now. Feel free to open a new one, if something fails. :)