diff options
author | sterni <sternenseemann@systemli.org> | 2022-06-18T13·29+0200 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2022-07-05T16·38+0000 |
commit | ab036ffe595c1cb445b664f95b3a959a9d993bfc (patch) | |
tree | 5fdfc52da8fe9be6132a7841717afd557c4b7cfc | |
parent | a8964cfc7bd77db231aa4cf0724739383735be0d (diff) |
fix(3p/lisp/cl-json): en/decode non-BMP characters correctly r/4278
Pin cl-json to a branch on my fork of cl-json which implements encoding and decoding of non-BMP Unicode codepoints (>= U+10000) using UTF-16 surrogate points as the JSON specs prescribes. While we're at it, also enable the test suite of the package. This resolves the annoying issue of panettone garbling up some Unicode characters by sending invalid JSON to cheddar and then incorrectly decoding the returned result. Fixes: b/145. Change-Id: I44cb38c2775c0e5512d75f51dff0d1deb39f8f78 Reviewed-on: https://cl.tvl.fyi/c/depot/+/5884 Tested-by: BuildkiteCI Autosubmit: sterni <sternenseemann@systemli.org> Reviewed-by: tazjin <tazjin@tvl.su>
-rw-r--r-- | third_party/lisp/cl-json.nix | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/third_party/lisp/cl-json.nix b/third_party/lisp/cl-json.nix index d56f9b9e1b6d..8dbb1567acb3 100644 --- a/third_party/lisp/cl-json.nix +++ b/third_party/lisp/cl-json.nix @@ -4,14 +4,22 @@ let inherit (depot.nix) buildLisp; - src = pkgs.srcOnly pkgs.quicklispPackages.cl-json; + # https://github.com/sharplispers/cl-json/pull/12/ + src = pkgs.fetchFromGitHub { + owner = "sternenseemann"; + repo = "cl-json"; + rev = "479685029c511cb2011f2f2a99ca6c63aa2e4865"; + sha256 = "1663xlzb0wj6kd0wy2cmhafrwip7vy0wlfckc519aj9j18aak5ja"; + }; + + getSrcs = subdir: map (f: src + ("/" + subdir + "/" + f)); in buildLisp.library { name = "cl-json"; deps = [ (buildLisp.bundled "asdf") ]; srcs = [ "${src}/cl-json.asd" ] ++ - (map (f: src + ("/src/" + f)) [ + (getSrcs "src" [ "package.lisp" "common.lisp" "objects.lisp" @@ -21,4 +29,25 @@ buildLisp.library { "utils.lisp" "json-rpc.lisp" ]); + + tests = { + deps = [ + depot.third_party.lisp.cl-unicode + depot.third_party.lisp.fiveam + ]; + srcs = [ + # CLOS tests are broken upstream as well + # https://github.com/sharplispers/cl-json/issues/11 + (pkgs.writeText "no-clos-tests.lisp" '' + (replace *features* (delete :cl-json-clos *features*)) + '') + ] ++ getSrcs "t" [ + "package.lisp" + "testencoder.lisp" + "testdecoder.lisp" + "testmisc.lisp" + ]; + + expression = "(fiveam:run! 'json-test::json)"; + }; } |