> I've narrowed down the conditions to produce a corrupt SQLite
> database with NestedVM and sqlite3 (in -batch mode). This bug will
> only happen when running sqlite3.mips via NestedVM (interped or jitted)
> on a Windows machine on a _local_ filesystem (i.e., C: drive).
I've found the cause of the sqlite3 database corruption in NestedVM.
The current NestedVM sys_fstat() implementation caches the old file
length() in certain circumstances. This can cause a lot of trouble
for SQLite database integrity, as you can imagine.
The attached patch avoids file length caching in fstat() (in JDK 1.4.2)
and allows the test case to successfully run to completion and
produce a database file with the correct md5sum.
There may be other filesystem-related attributes that are also cached
in NestedVM. It may take a while to track them all down.
If I can port Tcl to NestedVM, perhaps I can run the sqlite test suite.
This would certainly help find any other potential NestedVM filesystem
problems.
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SQLiteJDBC" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups-beta.google.com/group/sqlitejdbc?hl=en
-~----------~----~----~----~------~----~------~--~---
diff -rN -u old-nestedvm/src/org/ibex/nestedvm/Runtime.java
new-nestedvm/src/org/ibex/nestedvm/Runtime.java
--- old-nestedvm/src/org/ibex/nestedvm/Runtime.java 2006-10-08
23:16:15.000000000 -0400
+++ new-nestedvm/src/org/ibex/nestedvm/Runtime.java 2007-01-10
01:36:13.000000000 -0500
@@ -757,10 +757,10 @@
return null;
} catch(IOException e) { throw new ErrnoException(EIO); }
- return new SeekableFD(sf,flags) { protected FStat _fstat() { return
hostFStat(f,data); } };
+ return new SeekableFD(sf,flags) { protected FStat _fstat() { return
hostFStat(f,sf,data); } };
}
- FStat hostFStat(File f, Object data) { return new HostFStat(f); }
+ FStat hostFStat(File f, Seekable.File sf, Object data) { return new
HostFStat(f,sf); }
FD hostFSDirFD(File f, Object data) { return null; }
@@ -1341,10 +1421,13 @@
static class HostFStat extends FStat {
private final File f;
+ private final Seekable.File sf;
private final boolean executable;
- public HostFStat(File f) { this(f,false); }
- public HostFStat(File f, boolean executable) {
+ public HostFStat(File f, Seekable.File sf) { this(f,sf,false); }
+ public HostFStat(File f, boolean executable) {this(f,null,executable);}
+ public HostFStat(File f, Seekable.File sf, boolean executable) {
this.f = f;
+ this.sf = sf;
this.executable = executable;
}
public int dev() { return 1; }
@@ -1359,7 +1442,13 @@
if(f.canWrite()) mode |= 0222;
return mode;
}
- public int size() { return (int) f.length(); }
+ public int size() {
+ try {
+ return sf != null ? (int)sf.length() : (int)f.length();
+ } catch (Exception x) {
+ return (int)f.length();
+ }
+ }
public int mtime() { return (int)(f.lastModified()/1000); }
}