Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I asked Fable to rewrite the C library in Elixir, starting with porting the complete test suite from the upstream project. This is what it came up with.
Here's what it did:
Libwbxml.Nativetest/fixtures/upstream/. The upstream round-trip harness and its Perl normaliser were ported and verified against the C tools. 3. Token tables for all 29 languages were generated from the C source rather than transcribed. The codec is four modules:reader.ex(XML to tree via xmerl),encoder.ex,parser.ex, andwriter.ex, on top of Error, Charset, Base64, Tree, Opaque and Tables. All 1292 golden binary tests match byte for byte in both directions. The upstream round-trips pass through Elixir. With the NIF still present, 6650 fuzz mutations agreed with C.vendor/,native/, the Makefile, checksum, release workflow, the NIF loader, and the helper scripts. Bumpedmix.exsversion, updatedREADME.md,CHANGELOG.md,LICENSEandNOTICE.It made note of a number of points of weirdness it discovered in the upstream binary (noted with
NOTE(upstream-quirk)comments in the code)—one of which was a null pointer dereference which would bring down the whole BEAM (!).Do we want to ship this? I don't know. The fact that it's byte-identical with C makes me think it might actually be okay.