From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?UTF-8?Q?Joonas_Saraj=C3=A4rvi?= Newsgroups: gmane.lisp.guile.user Subject: Re: crash in guile-sqlite3 Date: Tue, 1 May 2012 18:01:06 +0300 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1335884482 29427 80.91.229.3 (1 May 2012 15:01:22 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 May 2012 15:01:22 +0000 (UTC) To: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue May 01 17:01:21 2012 Return-path: Envelope-to: guile-user@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SPEZt-0001nX-A4 for guile-user@m.gmane.org; Tue, 01 May 2012 17:01:21 +0200 Original-Received: from localhost ([::1]:36713 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEZs-0000cL-PM for guile-user@m.gmane.org; Tue, 01 May 2012 11:01:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:35557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEZk-0000bb-NG for guile-user@gnu.org; Tue, 01 May 2012 11:01:17 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPEZh-0006vo-LM for guile-user@gnu.org; Tue, 01 May 2012 11:01:12 -0400 Original-Received: from mail-lpp01m010-f41.google.com ([209.85.215.41]:62375) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEZh-0006vT-BZ for guile-user@gnu.org; Tue, 01 May 2012 11:01:09 -0400 Original-Received: by lagz14 with SMTP id z14so3106628lag.0 for ; Tue, 01 May 2012 08:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:content-type :content-transfer-encoding; bh=6ZdpQxGht9jnmVNigwtMNTJVxt+7zKMxXBZEoeChABw=; b=ZMkb0OwyVbyAgJJ0X4RX/B8KF0wr1UBGT3mgidb8nY/DuYrzx49SWMlSLietxs2Nwj b3OnpE6JsWyKTpQrgmIqkXdQc5yveS25j09n57VxjREwqEFRvL3cBciAjpF0sIO2gqy3 uT/pIk162y+OwQEj5nG8niYsxeB2Xhqb/3mcGLXp2odhxc+bPg8yeiSPG1DPEYPaJ0Gd JIt04hGo3UVrLCpowehWdHf0ckw46WYK4OkAsDtxQOPO8KW3iamCSda8ASs07tqW4Qoa sfnPbNWIAIA7z78BuJcxCpEv7t6Qhu91IABkCUwzG2HYvmUmu9OJOQuKfelB50HIBEH1 2+Ew== Original-Received: by 10.152.148.234 with SMTP id tv10mr11630965lab.41.1335884466913; Tue, 01 May 2012 08:01:06 -0700 (PDT) Original-Received: by 10.112.4.68 with HTTP; Tue, 1 May 2012 08:01:06 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: ml_HJZKrRNW4f2p6ydQ2YnjzlwY X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.215.41 X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:9432 Archived-At: 2012/5/1 Joonas Saraj=C3=A4rvi : > However, thank you for taking a look at the problem. The change you > placed at git://gitorious.org/~sunjoong/guile-sqlite3/sunjoongs-guile-sql= ite3.git > seems to completely resolve the crash for me. > > -Joonas Replying to myself, I now noticed that the change will not work in a 64-bit computer. My impression is that this is due to the fact that the 5th parameter taken by sqlite3_bind_text function is really a pointer and not an int. On amd64 computers, int are 4 bytes wide while pointers are 8 bytes. I also think that the older way of passing SQLITE_TRANSIENT as a pointer should work. However, there was a small bug in the code that constructed the pointer. I made a yet-another clone of the main guile-sqlite3 repository and pushed a change that I think fixes this. The change I did is also here: diff --git a/sqlite3.scm b/sqlite3.scm index fcc1fdf..5047e71 100644 --- a/sqlite3.scm +++ b/sqlite3.scm @@ -301,8 +301,9 @@ int (dynamic-func "sqlite3_bind_null" libsqlite3) (list '* int))) - (sqlite-transient (bytevector->pointer - (make-bytevector (sizeof '*) #xff)))) + (sqlite-transient (dereference-pointer + (bytevector->pointer + (make-bytevector (sizeof '*) #xff))))) (lambda (stmt key val) (assert-live-stmt! stmt) (let ((idx (key->index stmt key)) The test case by Sunjoong Lee is also cherry-picked to the git branch I placed on gitorious. Hopefully it was acceptable to include it. Should I make a merge request of this? -Joonas