[elephant-devel] Fix for Unicode2 serializer

Leslie P. Polzer leslie.polzer at gmx.net
Fri Feb 22 09:13:49 UTC 2008


> 	However, I wonder if it possible for you to turn whatever made you
> notice it into a test-case?  It is possible that this bug exists on the
> LISP you are using and not mine, but in any case we should use each such
> bug as an opportunity to expand the suite of automated tests.

It was hard, but I managed to add one. It won't work on all implementations
since the spec doesn't guarantee a way to generate a non-simple string.

It's very plain to see that the old code was wrong. In a branch where VAR
was guaranteed to be a STRING it used SCHAR, which is only defined for
SIMPLE-STRING (a subtype of STRING). I wonder how it could get away
with that for so long.


> 	As you will see, we have a tiny number of tests around unicode issues,
> which arose out of my using some Esperanto stuff.  However, I am sure
> our tests are not sufficient.

It would appear so :)


> 	The ideal thing would be to write a test, see that it fails without our
> patch, and then that it and all the other relevant tests are green with
> the patch in place.

I don't know how other Lisps handle this string stuff, but on SBCL (1.0.14,
probably earlier versions, too) the new test will fail. Note that if you
have a Lisp where the test doesn't fail (despite incorrect use of SCHAR),
you won't have any problems with the erroneous code, either.

Now, attached are three patch files containing the following:

  * the new test case

  * the fix

  * a refactoring of the UTF{16,32}LE serializers

If you want multiple revisions in one file in the future, please say so.

  Leslie

-- 
My personal blog: http://blog.viridian-project.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: STRING-test.patch
Type: text/x-patch
Size: 3859 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20080222/1b40bab8/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: unicode2.patch
Type: text/x-patch
Size: 4006 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20080222/1b40bab8/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: refactor-unicode-serializers.patch
Type: text/x-patch
Size: 7019 bytes
Desc: not available
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20080222/1b40bab8/attachment-0002.bin>


More information about the elephant-devel mailing list