Closed mwotton closed 10 years ago
I appreciate it! There's actually a one-line change that we have to make every time we upgrade. :( It has to do with the stat64 structure on OS X... I can get to it sometime this weekend, or if you are motivated and want to learn the details, you can educate yourself by examining a pull request for a previous sqlite version upgrade. :)
i couldn't test it on OS X anyway, so probably better for you to do it :)
On Sat, Jun 28, 2014 at 7:05 AM, Irene Knapp notifications@github.com wrote:
I appreciate it! There's actually a one-line change that we have to make every time we upgrade. :( It has to do with the stat64 structure on OS X... I can get to it sometime this weekend, or if you are motivated and want to learn the details, you can educate yourself by examining a pull request for a previous sqlite version upgrade. :)
— Reply to this email directly or view it on GitHub https://github.com/IreneKnapp/direct-sqlite/pull/47#issuecomment-47411935 .
A UNIX signature isn't a return address, it's the ASCII equivalent of a black velvet clown painting. It's a rectangle of carets surrounding a quote from a literary giant of weeniedom like Heinlein or Dr. Who. -- Chris Maeda
Fair enough! :)
i think
diff --git a/cbits/sqlite3.c b/cbits/sqlite3.c
index 9228d24..fb437d8 100644
--- a/cbits/sqlite3.c
+++ b/cbits/sqlite3.c
@@ -24251,6 +24251,17 @@ static int posixFchown(int fd, uid_t uid, gid_t gid){
/* Forward reference */
static int openDirectory(const char*, int*);
+
+int stat_local(const char *x, struct stat *y)
+{
+ return stat(x, y);
+}
+int fstat_local(int x, struct stat *y)
+{
+ return fstat(x, y);
+}
+
+
static int unixGetpagesize(void);
/*
@@ -24276,7 +24287,7 @@ static struct unix_syscall {
{ "getcwd", (sqlite3_syscall_ptr)getcwd, 0 },
#define osGetcwd ((char*(*)(char*,size_t))aSyscall[3].pCurrent)
- { "stat", (sqlite3_syscall_ptr)stat, 0 },
+ { "stat", (sqlite3_syscall_ptr)stat_local, 0 },
#define osStat ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent)
/*
@@ -24289,7 +24300,7 @@ static struct unix_syscall {
{ "fstat", 0, 0 },
#define osFstat(a,b,c) 0
#else
- { "fstat", (sqlite3_syscall_ptr)fstat, 0 },
+ { "fstat", (sqlite3_syscall_ptr)fstat_local, 0 },
#define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent)
#endif
is the needed change? Anyway, it's working locally.
(i would update the PR but emacs stripped the whitespace from the c files so it looks like a massive commit)
Ah, excellent, thank you! I very much appreciate your doing this work. I tagged this issue with a new tag, "useful", so that we can find your research easily next time around, haha. I'll fix the whitespace at my end and get this merged in, sometime tonight. :)
Thanks Irene :) looking to remove one of my seemingly infinite list of cabal sandbox add-source invocations...
Hi Irene - is there something blocking releasing this to hackage?
I'll apply the OS X change separately.
For the record, I think the author of this PR meant sqlite 3.8.5, not 3.5.
@mwotton @IreneKnapp This is working for me on Mac OS X without applying the stat fix. I'll try to dig out from the issues database why it's required. If you know, please let me know.
EDIT: it's documented in commit 6890f68e91f392fde6fb37ca33c2853e53fa233f. I'll try if it still repros.
Yeah - I tagged that issue as "useful" for this reason!
Since it was a patch around an upstream issue, probably they finally fixed it. :)
*Database.SQLite3> import Database.SQLite3
*Database.SQLite3 Database.SQLite3> import Data.Text
*Database.SQLite3 Database.SQLite3 Data.Text> conn <- open (pack ":memory:")
*Database.SQLite3 Database.SQLite3 Data.Text>
is working fine. But I don't know if this is pertinent to some particular GHC and/or Mac OS X version.
I'm thinking I'll release without it and make a point release with this patch if someone complains.
EDIT: I think I'll just apply the path.
This is now in direct-sqlite-2.3.14 on Hackage.
i noticed there was a new sqlite, so figured the bundling could be updated. No sweat if you've already got a process for doing this :)