[plt-scheme] sqlite.plt seg faults with 370

From: Keith Frost (keith.l.frost at gmail.com)
Date: Sat Sep 1 19:13:22 EDT 2007

And here is the equivalent test module for sqlite.plt:

(module testing2-sqlite mzscheme
  (require (planet "sqlite.ss" ("jaymccarthy" "sqlite.plt" 3 1))
           (lib "md5.ss"))
  (provide insert-records test-retrieval)

  (define *db* (open (string->path "/tmp/test.sqd")))
  (define (md5code n)
    (bytes->string/latin-1 (md5 (string->bytes/latin-1 (number->string n)))))

  (define (insert-records n)
    (define instmt
         "create table if not exists notes (id INTEGER PRIMARY KEY,
note TEXT);")
        (prepare *db* "insert or ignore into notes values (?, ?);")))
     (*db* fail)
     (do ((i 1 (+ i 1)))
       ((> i n))
       (run instmt i (md5code i))
       (reset instmt)))
    (printf "Successfully inserted ~a records...\n" n))

  (define (test-retrieval n)
    (define result (select *db*
                           (format "select * from notes where id <= ~a;" n)))
    (do ((i 1 (+ 1 i))
         (x #f)
         (y #f))
      ((> i n) (printf "Successfully retrieved ~a records...\n" n))
      (set! result (cdr result))
      (set! x (car result))
      (set! y (vector (number->string i) (md5code i)))
      (unless (equal? x y)
        (error (format "Got values ~a.  Expected ~a." x y))))))

; with transcript (I already inserted the records, so why not just
retrieve them...)
Welcome to MzScheme v371 [3m], Copyright (c) 2004-2007 PLT Scheme Inc.
> (require "testing2-sqlite.scm")
> (test-retrieval 1000)
Successfully retrieved 1000 records...
> (test-retrieval 10000)
Successfully retrieved 10000 records...
> (test-retrieval 100000)
Seg fault (internal error) at 0xb530cc24
Aborted (core dumped)

Posted on the users mailing list.