xsc / pandect

Fast and easy-to-use Message Digest, Checksum and HMAC library for Clojure
https://cljdoc.org/d/pandect/pandect/CURRENT
MIT License
222 stars 11 forks source link

make ns conform to spec, for clojure 1.9 compatibility #18

Closed bostonaholic closed 3 years ago

bostonaholic commented 5 years ago

Version 0.6.1 is not compatible to Clojure 1.9 due to an invalid ns form.

clojure.lang.ExceptionInfo: Call to clojure.core/ns did not conform to spec.
        clojure.spec.alpha/args: (pandect.impl.checksum
                                  (:require
                                   [pandect.gen
                                    [core :refer :all]
                                    [hash-generator :refer :all]
                                    [hmac-generator :refer :all]]
                                   [pandect.utils.convert :as c only [long->4-bytes]])
                                  (:import [java.util.zip Adler32 CRC32]))
    clojure.spec.alpha/problems: [{:path [],
                                   :reason "Extra input",
                                   :pred
                                   (clojure.spec.alpha/cat
                                    :docstring
                                    (clojure.spec.alpha/? clojure.core/string?)
                                    :attr-map
                                    (clojure.spec.alpha/? clojure.core/map?)
                                    :ns-clauses
                                    :clojure.core.specs.alpha/ns-clauses),
                                   :val
                                   ((:require
                                     [pandect.gen
                                      [core :refer :all]
                                      [hash-generator :refer :all]
                                      [hmac-generator :refer :all]]
                                     [pandect.utils.convert :as c only [long->4-bytes]])
                                    (:import [java.util.zip Adler32 CRC32])),
                                   :via [:clojure.core.specs.alpha/ns-form],
                                   :in [1]}]
        clojure.spec.alpha/spec: #object[clojure.spec.alpha$regex_spec_impl$reify__2509 0x49433c98 "clojure.spec.alpha$regex_spec_impl$reify__2509@49433c98"]
       clojure.spec.alpha/value: (pandect.impl.checksum
                                  (:require
                                   [pandect.gen
                                    [core :refer :all]
                                    [hash-generator :refer :all]
                                    [hmac-generator :refer :all]]
                                   [pandect.utils.convert :as c only [long->4-bytes]])
                                  (:import [java.util.zip Adler32 CRC32]))
bostonaholic commented 4 years ago

@xsc any chance in getting this merged and released?

gozes commented 4 years ago

@xsc I guess this will never get mareg 😭

xsc commented 3 years ago

@bostonaholic @gozes Hey there! I'm currently updating the codebase - it has been a while - and looking at open issues.

I can't reproduce the issue you're having. And the error that you encountered seems to point at this being the problem:

[pandect.utils.convert :as c only [long->4-bytes]]
-----------------------------^

only should be :only to be valid. However, this has been fixed in 2016 (#15) and should already have been working correctly in version 0.6.1.

bostonaholic commented 3 years ago

Thanks for looking into it @xsc. I'm no longer on the project where this was an issue so I can't really look into it. It very well could have been caused by something completely different or possibly an issue with transitive dependencies.

xsc commented 3 years ago

@bostonaholic I'll close the issue then. And sorry for the multi-year latency! 😬

bostonaholic commented 3 years ago

@xsc Looking at my changes, are we sure the nested vectors are valid according to spec? I'm trying to replicate locally just to be sure.

xsc commented 3 years ago

Yeah, that should be a valid form in Clojure (ClojureScript does not allow the nesting, iirc), to the best of my knowledge.

bostonaholic commented 3 years ago

Looking at the spec exception above, seeing that it doesn't have the keyword version of :only, I suspect that was the issue. And I also suspect that this could have been due to nested dependencies pulling in an older version of pandect even if the project I was working on declared 0.6.1. I don't have access to it any longer, otherwise I'd keep digging.

Thanks for taking a look.