diff options
author | Ludovic Courtès <ludo@gnu.org> | 2013-12-30 22:29:12 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2013-12-30 22:29:12 +0100 |
commit | dedb5d947ee2890524a5c6fb1343b3299e7731c3 (patch) | |
tree | ee9767de32d8c7e3f60be659ac5599c05626f348 /guix | |
parent | 36341854dfedc3d173d09e686ffc3e255c102b01 (diff) | |
download | gnu-guix-dedb5d947ee2890524a5c6fb1343b3299e7731c3.tar gnu-guix-dedb5d947ee2890524a5c6fb1343b3299e7731c3.tar.gz |
pk-crypto: Fix 'canonical-sexp->sexp' for atoms.
* guix/pk-crypto.scm (canonical-sexp->sexp): Add hack to extract an
atom's buffer.
* tests/pk-crypto.scm ("sexp->canonical-sexp->sexp"): Add sample.
Diffstat (limited to 'guix')
-rw-r--r-- | guix/pk-crypto.scm | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/guix/pk-crypto.scm b/guix/pk-crypto.scm index cf18faea04..d5b3eeb350 100644 --- a/guix/pk-crypto.scm +++ b/guix/pk-crypto.scm @@ -319,7 +319,14 @@ use pattern matching." result)) '() sexp)) - (canonical-sexp->string sexp))) ; XXX: not very useful + + ;; As of Libgcrypt 1.6.0, there's no function to extract the buffer of a + ;; non-list sexp (!), so we first enlist SEXP, then get at its buffer. + (let ((sexp (string->canonical-sexp + (string-append "(" (canonical-sexp->string sexp) + ")")))) + (or (canonical-sexp-nth-data sexp 0) + (canonical-sexp-nth sexp 0))))) (define (sexp->canonical-sexp sexp) "Return a canonical sexp equivalent to SEXP, a Scheme sexp as returned by |