Welcome! Please see the About page for a little more info on how this works.

0 votes
in data.fressian by
While running the tests on https://github.com/danielcompton/data.fressian-test I found this bug:


(let [mys {[3] [] :a nil, :b nil :c nil :d nil :e nil :f nil :g nil}
      myf (fr/read (fr/write mys))]
  (println (type mys))
  (println (type (key (first mys))))
  (println (type myf))
  (println (type (key (first myf))))
  (= mys myf))
clojure.lang.PersistentArrayMap
clojure.lang.PersistentVector
clojure.lang.PersistentHashMap
java.util.Arrays$ArrayList
=> false


Changing the key [3] to :x

{:x [] :a nil, :b nil :c nil :d nil :e nil :f nil :g nil}


or removing another kv pair

{[3] [] :b nil :c nil :d nil :e nil :f nil :g nil}


will make the roundtrip encoding of Fressian values equal.

This is because of the changes in hashing behaviour introduced in 1.6 and relates to CLJ-1372. I think there may also be some interaction with Fressian's creation of ArrayMaps for maps with less than 8 kv pairs.

One fix would be to make sure data.fressian always returns persistent Clojure data structures, so it avoids tripping over Clojure no longer having Java data structures be equal to their analogous Clojure ones.

2 Answers

0 votes
by

Comment made by: desk@danielcompton.net

Clarify issue.

0 votes
by
Reference: https://clojure.atlassian.net/browse/DFRS-7 (reported by desk@danielcompton.net)
...