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:10:22 +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 1335885034 1384 80.91.229.3 (1 May 2012 15:10:34 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 May 2012 15:10:34 +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:10:33 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 1SPEil-0006K6-NC for guile-user@m.gmane.org; Tue, 01 May 2012 17:10:31 +0200 Original-Received: from localhost ([::1]:38916 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEil-0002B9-0f for guile-user@m.gmane.org; Tue, 01 May 2012 11:10:31 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEig-0002B1-Sv for guile-user@gnu.org; Tue, 01 May 2012 11:10:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SPEif-0001lF-3h for guile-user@gnu.org; Tue, 01 May 2012 11:10:26 -0400 Original-Received: from mail-pb0-f41.google.com ([209.85.160.41]:43435) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SPEie-0001l8-RK for guile-user@gnu.org; Tue, 01 May 2012 11:10:25 -0400 Original-Received: by pbbrp2 with SMTP id rp2so2462504pbb.0 for ; Tue, 01 May 2012 08:10:22 -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=AXE4lP+B85E/e7mtCXPA1DbTocnHJOsOKRt+Z7xdc7E=; b=Fnsj9oGdWiXIx3V//R7IZPP6C1fbh604/t1a1fgQnsnrFDNkhdGEhajUgh8A2M6l3f qJxlLhSK+D7GIJboY46b90B3MRWtQY1XcbcyzKKcoRqYvqQ+wk4tQodR9ndfD/N/Ye1r IPWGPQRcOrfWbXQxLKIxmATyNW8VAWLaVZTQMnD5f6ABmS13tFvChviiLhrqcqh94Ish QFz4yvO4HUXcFYKnELRzfx7PvLlxts2u0TUwGFPhDhLJh0B+xjD2lwRlwhdCQCkMYAR5 Novx3ZsJMymZ/AShqQEaKcSqs22vBtM+xZi5zMVT6dvANw/wYBJDYC020zf+a+nriTo7 5emQ== Original-Received: by 10.68.228.106 with SMTP id sh10mr57681767pbc.107.1335885022618; Tue, 01 May 2012 08:10:22 -0700 (PDT) Original-Received: by 10.142.171.15 with HTTP; Tue, 1 May 2012 08:10:22 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.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:9434 Archived-At: Oh, I'm sorry, I missed the fact that all bits in the pointer would be set. Correct would be this: (make-pointer (bit-extract (lognot 0) 0 (* 8 (sizeof '*)))) So, okay, this may not be a better solution :D - Daniel On Tue, May 1, 2012 at 5:05 PM, Daniel Krueger wro= te: > 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-s= qlite3.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 (= sizeof '*) #xff)))) >> + =A0 =A0 =A0 =A0(sqlite-transient (dereference-pointer >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (bytevector->point= er >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(make-bytevecto= r (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 >>