-
Notifications
You must be signed in to change notification settings - Fork 61
computeDigest
always return [0, 0]?
#97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
computeDigest
always return [0, 0]?
Closing here, as this affects the library upstream (if it's a bug), but nonetheless @sgbeal FYI. The present project wraps the upstream library for npm. |
i will look at this in the upstream tree in the next few hours. @Spxg please feel free to re-post this in the sqlite forum. If it's misbehaving this way then it's a fluke that it ever worked. |
i can definitely reproduce this, and the fault is absolutely mine, but we have a slight problem with fixing it. From the documentation:
i'll need to come up with a fix which is only applied when re-populating the VFS from scratch. (Edit: that introduces another problem, though: the VFS has no persistent place to store the fact that it needs to use the updated/working digest. So i'm not sure how to fix this without invaliding every db out there. Sheesh!) Thank you for the report! |
Yes, fixing this will be a breaking change. In addition, another issue also mentioned you, you can take a look if you have time: #92 Thank you for the fast turnaround. |
It currently appears so but maybe not: we have 32 bits for flags in the per-file header and what i'd like to do is, when creating a new file, set that bit to indicate that we can use a working computeDigest(). When opening an a file created before this (as yet hypothetical) fix, that flag bit will be unset and we'll use the no-op/broken digest. That's the plan, anyway, and this will be my priority today. It's unfortunately too late to get into the 3.49 release, which is currently being prepared, but it would be in any subsequent 3.49.x patch release. Thank you again for the report! |
@Spxg i have a potential fix for this checked in, but (A) it won't be part of 3.49.0 and (B) it requires a good deal more testing before i'm satisfied that it behaves sanely with older-format files. In short, it only applies the digest when creating new VFS entries, and then records the fact that the digest should be checked in one of the file's flags. Older-format files have a 0 in that flag bit and will revert to the old behavior of (effectively) no checksum. In any case, this will, assuming it works out, be part of 3.50 and possibly 3.49.1. BTW: i'd be interested in hearing how you found this bug. |
I wrapped Because there are two different wasm instances ( But I want to provide an additional, more "native" version, compiling After a simple polyfill (enable Thanks to you and the community for making it possible to run |
FWIW, i strongly recommend following the works of Roy Hashimoto over at: in particularly his wa-sqlite project. To the best of my knowledge he was the first person to get OPFS working with SQLite and he has undoubtedly done far, far more research and experimentation into how to improve upon it than anyone else. His project provides a large handful of VFSes which explore various benefits and trade-offs. Plus, he writes modern JS using modern JS-centric toolchains, so his code is certainly more approachable than ours for most JS developers. Contrast that with us in the SQLite project, who deliberately/willfully/stubbornly stick to "vanilla JS" without using any of all-too-fluid modern JS frameworks. |
Very helpful! Because I also need to implement a memvfs as the default vfs, the examples provided by wa-sqlite can help me very well. |
sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
Line 13510 in 7c1b309
sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs
Line 13321 in 7c1b309
computeDigest
seems to only return [0, 0], because the length ofapBody
Uint8Array is 516, which will cause h1 h2 to be infinite.The text was updated successfully, but these errors were encountered: