Sexp changes between 1.5.3 and 1.6.0
wk at gnupg.org
Tue Jan 28 12:58:56 CET 2014
On Sat, 21 Dec 2013 21:15, ludo at gnu.org said:
> (BTW, as a Schemer, it took me a while to understand that car and nth do
> not correspond to their traditional Lisp counterpart: the Lisp car and
> nth return the given element, regardless of whether it is a list or an
Well, that is a bug and it is related to your reproted bug 1594. I have
now fixed it in master and will backport it to 1.6:
sexp: Fix broken gcry_sexp_nth.
* src/sexp.c (_gcry_sexp_nth): Return a valid S-expression for a data
(NODE): Remove unused typedef.
(ST_HINT): Comment unused macro.
* tests/t-sexp.c (bug_1594): New.
(main): Run new test.
Before 1.6.0 gcry_sexp_nth (list, 0) with a LIST of "(a (b 3:pqr) (c
3:456) (d 3:xyz))" returned the entire list. 1.6.0 instead returned
NULL. However, this is also surprising and the expected value would
be "(a)". This patch fixes this.
Somewhat related to that gcry_sexp_nth returned a broken list if
requesting index 1 of a list like "(n foo)". It returned just the
"foo" but not as a list which is required by the S-expression specs.
Due to this patch the returned value is now "(foo)".
Thanks to Ludovic Courtès for pointing out these problems.
I don't expect that this will introduce incompatibilities. A reason why
we have this uncommon behaviour in Libgcrypt is a bug in the original
GnuPG-2 code which created an S-expression "foo" at one place. This is
clearly not allowed but I realized that too late and thus had to stick
with it for some years. Meanwhile this problem has been solved in
Die Gedanken sind frei. Ausnahmen regelt ein Bundesgesetz.
More information about the Gcrypt-devel