From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Krueger Newsgroups: gmane.lisp.guile.user Subject: Re: crash in guile-sqlite3 Date: Tue, 1 May 2012 17:05:27 +0200 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1335884741 31434 80.91.229.3 (1 May 2012 15:05:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 May 2012 15:05:41 +0000 (UTC) Cc: guile-user@gnu.org To: =?ISO-8859-1?Q?Joonas_Saraj=E4rvi?= Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Tue May 01 17:05:39 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 1SPEe3-0003wJ-Eu for guile-user@m.gmane.org; Tue, 01 May 2012 17:05:39 +0200 Original-Received: from localhost ([::1]:37063 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEe2-00011o-Og for guile-user@m.gmane.org; Tue, 01 May 2012 11:05:38 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:57851) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEdx-00011c-1Z for guile-user@gnu.org; Tue, 01 May 2012 11:05:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPEdv-0000Ka-5b for guile-user@gnu.org; Tue, 01 May 2012 11:05:32 -0400 Original-Received: from mail-yx0-f169.google.com ([209.85.213.169]:63654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEdu-0000KE-Us for guile-user@gnu.org; Tue, 01 May 2012 11:05:31 -0400 Original-Received: by yenm8 with SMTP id m8so2289285yen.0 for ; Tue, 01 May 2012 08:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=skhBRBBi55cQsnnXpknSsuBG7StudWDdY043b7a03zg=; b=0fATKPM0sWF1LaKNNcVeSbzH//x00PVWQw7bJjLsan34JdDnmP+Bk5c8P3M5EMDtll zbNRC8mSUKP9WW8/GvRjW5O4jrzpuWOJDBIdkRL3z+Jr5T0uy2tyOEGo5tWoEE01lM+7 oU05HOeTY8VV1/6lIfKFewbXj7BYiCPKp8KjowuOPqrDYtKDvsYFHqB8kE+jQqqe0pAr LV7Yrqk1RYMq//EqKt/e/2G5dkYGTX+8+LSrvtJ9WtSyk6wUzsZ08S5WOMzSUXeCZM2v eQanoayfVssuwV9PtLJGuFdEJxiH/s7kE1Kj9X1+dfXY/suV1o+/HXJy+1aC5WqnWfwl UV/Q== Original-Received: by 10.68.136.8 with SMTP id pw8mr668508pbb.77.1335884727834; Tue, 01 May 2012 08:05:27 -0700 (PDT) Original-Received: by 10.142.171.15 with HTTP; Tue, 1 May 2012 08:05:27 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.213.169 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:9433 Archived-At: Hi, I just wanted to note that it should work just to use (make-pointer #xff). - Daniel On Tue, May 1, 2012 at 5:01 PM, Joonas Saraj=E4rvi wrote: > 2012/5/1 Joonas Saraj=E4rvi : > >> However, thank you for taking a look at the problem. The change you >> placed at git://gitorious.org/~sunjoong/guile-sqlite3/sunjoongs-guile-sq= lite3.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 @@ > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 int > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (dynamic-func "sqlite3_bind_null"= libsqlite3) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (list '* int))) > - =A0 =A0 =A0 =A0(sqlite-transient (bytevector->pointer > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (make-bytevector (s= izeof '*) #xff)))) > + =A0 =A0 =A0 =A0(sqlite-transient (dereference-pointer > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (bytevector->pointe= r > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(make-bytevector= (sizeof '*) #xff))))) > =A0 =A0 (lambda (stmt key val) > =A0 =A0 =A0 (assert-live-stmt! stmt) > =A0 =A0 =A0 (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 >