From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: Problems with guile-sqlite3 Date: Thu, 31 Mar 2011 12:25:18 +0200 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1301574546 16713 80.91.229.12 (31 Mar 2011 12:29:06 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 31 Mar 2011 12:29:06 +0000 (UTC) Cc: guile-devel@gnu.org To: Detlev Zundel Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Mar 31 14:29:01 2011 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q5Gzj-0008Pe-Ay for guile-devel@m.gmane.org; Thu, 31 Mar 2011 14:28:59 +0200 Original-Received: from localhost ([127.0.0.1]:46185 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5Gzi-0002te-Mk for guile-devel@m.gmane.org; Thu, 31 Mar 2011 08:28:58 -0400 Original-Received: from [140.186.70.92] (port=41752 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q5Gz9-0002cd-Sb for guile-devel@gnu.org; Thu, 31 Mar 2011 08:28:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q5Gz8-00041w-7v for guile-devel@gnu.org; Thu, 31 Mar 2011 08:28:23 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:42784 helo=sasl.smtp.pobox.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q5Gz8-00041r-5o for guile-devel@gnu.org; Thu, 31 Mar 2011 08:28:22 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id CE6043C7B; Thu, 31 Mar 2011 08:30:11 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=Mvoy3aP4TCy7mlbVKlOxXT3/dPw=; b=BQUu29 yJ2eeEtX/G5DD5popL81hQWqyW+g2bQnLwQ6sfj8FaKJw9T1xEe2UPsaJjTrXtQC V7GfVuZ+FuyPN7yC4W4kj7V76kFj5oZv51RcWy7jniotpZmVWQnK1SqHK3zrEcrC LbJI2ELblLzrp0ilezIZ+RFgNfNfx8m8/JoNU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=mD+9Uy7sIOfZLjifek05Q6LHVtDIWHye MciZU76RIMovi2kVOJLkqYgnbjXiyGPBMjuc7Nb624hkKce8338grUHiqBYi2NIb qRO7KaGBFCLbCv6KMg46HZSVwzaVcttZ2wmm0Q7rq6wR5nkalH2DCcjw6C2ygJJj Ok7stVZhDHM= Original-Received: from a-pb-sasl-sd.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id B96463C7A; Thu, 31 Mar 2011 08:30:09 -0400 (EDT) Original-Received: from unquote.localdomain (unknown [90.164.198.39]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id F13513C79; Thu, 31 Mar 2011 08:30:07 -0400 (EDT) In-Reply-To: (Detlev Zundel's message of "Thu, 31 Mar 2011 00:52:47 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Pobox-Relay-ID: 9E16036E-5B92-11E0-B247-E8AB60295C12-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 64.74.157.62 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:12113 Archived-At: On Thu 31 Mar 2011 00:52, Detlev Zundel writes: > | scheme@(guile-user)> (sqlite-open "mydb" SQLITE_OPEN_READONLY) > | ;;; :2:0: warning: possibly unbound variable `SQLITE_OPEN_READONLY' > | :1:0: In procedure #:2:0 ()>: > | :1:0: In procedure module-lookup: Unbound variable: SQLITE_OPEN_READONLY > `---- > > Hm ok, so the constants seem not to be exported, right? Hah, it appears not. Want to fix it? Fork the project on github and send me a merge request :) > ,---- > | scheme@(guile-user)> (define db (sqlite-open "mydb" 1)) > | :0:0: In procedure #:1:0 ()>: > | :0:0: Throw to key `sqlite-error' with args `(sqlite-open 14 "Unable to open the database file")'. > `---- > > But that is strange, I'm sure I have this file. So lets do an "strace > -e open guile" and see what guile accesses: > > ,---- > | .... > | open("/usr/local/lib/guile/2.0/ccache/language/bytecode/spec.go", O_RDONLY) = 91 > | open("/opt/src/git/guile-sqlite3/tests/mydb\315\201", O_RDONLY|O_LARGEFILE) = -1 ENOENT (No such file or directory) > | :0:0: In procedure #:1:0 ()>: > | :0:0: Throw to key `sqlite-error' with args `(sqlite-open 14 "Unable to open the database file")'. > `---- > > Huh, what are those characters after "mydb"? Funnily enough, if I use > filenames longer than 4 characters it works. Can someone hit me with a > clue-stick please? Interesting. It seems that the string->pointer code is doing the wrong thing: (define (string->utf8-pointer s) (bytevector->pointer (string->utf8 s))) Indeed, there's no null-termination on this string. I guess we need to copy into a bytevector that is longer and provide a NUL byte. Want to patch that one too? Cheers, Andy -- http://wingolog.org/