[elephant-devel] Fix for Unicode2 serializer
Robert L. Read
read at robertlread.net
Mon Feb 25 13:54:28 UTC 2008
Dear Leslie,
In attempting to apply the second of your three patches
(unicode2.patch), darcs says:
[read at penguin elephant]$ darcs apply ../unicode2.patch
darcs failed: Patch bundle failed hash!
This probably means that the patch has been corrupted by a mailer.
The most likely culprit is CRLF newlines.
However, the hunks:
hunk ./src/elephant/unicode2.lisp 131
- (let ((code (char-code (schar string i))))
+ (let ((code (char-code (char string i))))
hunk ./src/elephant/unicode2.lisp 171
- (let ((code (char-code (schar string i))))
+ (let ((code (char-code (char string i))))
Don't seem to match the version of unicode2.lisp that I have, which
seems to be the official repository version.
It is possible that you have not recently done a "darcs pull" against
the official repository
(http://www.common-lisp.net/project/elephant/darcs/elephant))?
Whatever the cause of the problem, I am happy to make the fixes by hand.
If would prefer to figure out how we are incorrectly using darcs, but
you can also just send me a "context" diff and I will make the changes
by hand.
On Fri, 2008-02-22 at 10:13 +0100, Leslie P. Polzer wrote:
> > 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/
More information about the elephant-devel
mailing list