unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Sunjoong Lee <sunjoong@gmail.com>
To: "Joonas Sarajärvi" <muep@iki.fi>
Cc: guile-user@gnu.org, David Pirotte <david@altosw.be>
Subject: Re: crash in guile-sqlite3
Date: Sun, 29 Apr 2012 10:58:20 +0900	[thread overview]
Message-ID: <CAK93xhpuEfERKX=XDSNDH=9LJiafh+Jc07Z1MoXRaYv1rBU+bA@mail.gmail.com> (raw)
In-Reply-To: <CAK93xhrAvVQz-OoJvLhkUj_YKb3TXwtXYeQhBfgY6tuvqQPRZg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2497 bytes --]

Hi, Joonas;

Yesterday, David said simple solution of yours. I think I found the case
of segfault.

########## cut here ##########
--- sqlite3.scm.old 2012-01-24 00:22:10.000000000 +0900
+++ sqlite3.scm 2012-04-29 10:37:37.999722092 +0900
@@ -284,11 +284,11 @@
   (let ((bind-blob (pointer->procedure
                     int
                     (dynamic-func "sqlite3_bind_blob" libsqlite3)
-                    (list '* int '* int '*)))
+                    (list '* int '* int int)))
         (bind-text (pointer->procedure
                     int
                     (dynamic-func "sqlite3_bind_text" libsqlite3)
-                    (list '* int '* int '*)))
+                    (list '* int '* int int)))
         (bind-int64 (pointer->procedure
                      int
                      (dynamic-func "sqlite3_bind_int64" libsqlite3)
@@ -301,8 +301,7 @@
                     int
                     (dynamic-func "sqlite3_bind_null" libsqlite3)
                     (list '* int)))
-        (sqlite-transient (bytevector->pointer
-                           (make-bytevector (sizeof '*) #xff))))
+        (sqlite-transient -1))
     (lambda (stmt key val)
       (assert-live-stmt! stmt)
       (let ((idx (key->index stmt key))
########## cut here ##########

2012/4/27 Sunjoong Lee <sunjoong@gmail.com>
>
> Same crash on Guile 2.0.5. It looks like string encoding problem. Suppose
> name be an integer not a string like 10, it would not crash. sqlite-bind
> of Guile-SQLite3 will deliver this 10 to sqlite3_bind_int64 of libsqlite3.
> If a string, it will use sqlite3_bind_text of libsqlite3. Before
> delivering, it will encoding this string to utf-8 string pointer because
> sqlite3_bind_text need to know string pointer and it's length. I think you
> or Andy may look around that.
>

 In the http://www.sqlite.org/c3ref/c_static.html ,
#define SQLITE_TRANSIENT   ((sqlite3_destructor_type)-1)

I.e, SQLITE_TRANSIENT is actually -1, not some position of
memory. sqlite-bind of Guile-SQLite3 had treated it as a pointer, an
address of memory position.

Oh, another one; your test code ex0.scm has a bug.

--- ex0.scm.old 2012-04-29 10:57:09.717398060 +0900
+++ ex0.scm 2012-04-29 10:39:20.051261614 +0900
@@ -34,7 +34,7 @@
   ;; This finalize call in particular seems to break things
   (sqlite-finalize stmt)
   ;; This seems to be never reached.
-  (display "finalized\n")))
+  (display "finalized\n"))

 (display "closing\n")
 (sqlite-close db)
\ No newline at end of file

[-- Attachment #2: Type: text/html, Size: 4028 bytes --]

  parent reply	other threads:[~2012-04-29  1:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-27  5:40 crash in guile-sqlite3 Sunjoong Lee
2012-04-27 19:00 ` David Pirotte
2012-04-27 20:08   ` Sunjoong Lee
2012-04-27 22:58     ` David Pirotte
2012-04-27 23:59     ` David Pirotte
2012-04-29  1:58 ` Sunjoong Lee [this message]
2012-04-30  9:00   ` Andy Wingo
2012-04-30 10:32     ` Sunjoong Lee
2012-04-30 10:46       ` Andy Wingo
2012-04-30 12:44         ` Sunjoong Lee
2012-05-01 11:45   ` Joonas Sarajärvi
2012-05-01 15:01     ` Joonas Sarajärvi
2012-05-01 15:05       ` Daniel Krueger
2012-05-01 15:10         ` Daniel Krueger
  -- strict thread matches above, loose matches on Subject: below --
2012-05-01 19:37 Sunjoong Lee
2012-05-02  4:41 ` Joonas Sarajärvi
2012-04-26 18:51 Joonas Sarajärvi
2012-04-26 20:24 ` rixed
2012-04-26 21:04   ` Noah Lavine
2012-04-27  6:31     ` rixed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK93xhpuEfERKX=XDSNDH=9LJiafh+Jc07Z1MoXRaYv1rBU+bA@mail.gmail.com' \
    --to=sunjoong@gmail.com \
    --cc=david@altosw.be \
    --cc=guile-user@gnu.org \
    --cc=muep@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).