unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Daniel Krueger <keenbug@googlemail.com>
To: "Joonas Sarajärvi" <muep@iki.fi>
Cc: guile-user@gnu.org
Subject: Re: crash in guile-sqlite3
Date: Tue, 1 May 2012 17:10:22 +0200	[thread overview]
Message-ID: <CAAh5vOM-2nbF8DLttESrVHuiihyJubTwsENqLEt8jd6Xob_EzQ@mail.gmail.com> (raw)
In-Reply-To: <CAAh5vOOErrjF4utWvyEJyrzCQHEvyM8ROAJeBEgoJvPGRgwrBQ@mail.gmail.com>

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 <keenbug@googlemail.com> wrote:
> 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ärvi <muep@iki.fi> wrote:
>> 2012/5/1 Joonas Sarajärvi <muep@iki.fi>:
>>
>>> However, thank you for taking a look at the problem. The change you
>>> placed at git://gitorious.org/~sunjoong/guile-sqlite3/sunjoongs-guile-sqlite3.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
>>



  reply	other threads:[~2012-05-01 15:10 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
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 [this message]
  -- 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=CAAh5vOM-2nbF8DLttESrVHuiihyJubTwsENqLEt8jd6Xob_EzQ@mail.gmail.com \
    --to=keenbug@googlemail.com \
    --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).