]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove the ostensible support for empty kvvfs names, as those names apparently never...
authorstephan <stephan@noemail.net>
Tue, 25 Nov 2025 19:05:13 +0000 (19:05 +0000)
committerstephan <stephan@noemail.net>
Tue, 25 Nov 2025 19:05:13 +0000 (19:05 +0000)
FossilOrigin-Name: a5c61fa56770a6fffcb4c76db2256c71b2d5f0beee6fc2c4800c40bf7ef995c8

ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js
ext/wasm/tester1.c-pp.js
manifest
manifest.uuid

index e0146deda474df4b8078000d9a3414af034029d5..ebddb76094872654650fe74120a63dbfb5fd79d6 100644 (file)
@@ -206,8 +206,9 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
       maxLen -= 8 /* "-journal" */;
     }
     const len = n.length;
+    if( !len ) toss3(capi.SQLITE_RANGE,"Empty name is not permitted.");
     if( len > maxLen ){
-      toss3(capi.SQLITE_RANGE, "Storage name is too long.");
+      toss3(capi.SQLITE_RANGE, "Storage name is too long. Limit =", maxLen);
     }
     let i;
     for( i = 0; i < len; ++i ){
@@ -454,14 +455,6 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
   */
   const pFileHandles = new Map();
 
-  if( sqlite3.__isUnderTest ){
-    /* For inspection via the dev tools console. */
-    sqlite3.kvvfsStuff = {
-      pFileHandles,
-      cache
-    };
-  }
-
   {
     /**
        Original WASM functions for methods we partially override.
@@ -621,6 +614,7 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
               zName = (cache.zEmpty ??= wasm.allocCString(""));
             }
             const jzClass = wasm.cstrToJs(zName);
+            debug("xOpen",jzClass);
             validateStorageName(jzClass, true);
             util.assert( jzClass.length===wasm.cstrlen(zName),
                          "ASCII-only validation failed" );
@@ -916,13 +910,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
      - A transient kvvfs storage object name.
 
      In the first two cases, only sessionStorage resp. localStorage is
-     cleared. If passed an an empty string (the default) then its
-     behavior depends on the second argument:
-
-     If emptyIsAName is false (the default) then an empty string means
-     both of 'local' and 'session' storage. (For backwards
-     compatibility.) if emptyIsAName is true then the empty string is
-     treated as a storage name instead.
+     cleared. An empty string resolves to both 'local' and 'session'
+     storage.
 
      Returns the number of entries cleared.
 
@@ -944,8 +933,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
      version 1 did not throw for this case was due to an architectural
      limitation which has since been overcome.
   */
-  capi.sqlite3_js_kvvfs_clear = function callee(which="", emptyIsAName=false){
-    if( !which && !emptyIsAName && cache.storagePool.local ){
+  capi.sqlite3_js_kvvfs_clear = function callee(which=""){
+    if( !which ){
       return callee('local') + callee('session');
     }
     const store = storageForZClass(which);
@@ -986,8 +975,8 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
      unspecified and may include per-entry overhead invisible to
      clients.
   */
-  capi.sqlite3_js_kvvfs_size = function callee(which="", emptyIsAName=false){
-    if( !which && !emptyIsAName ){
+  capi.sqlite3_js_kvvfs_size = function callee(which=""){
+    if( !which ){
       return callee('local') + callee('session');
     }
     const store = storageForZClass(which);
@@ -1335,11 +1324,18 @@ globalThis.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
     listen:   sqlite3_js_kvvfs_listen,
     unlisten: sqlite3_js_kvvfs_unlisten,
     exists:   (name)=>!!storageForZClass(name),
-    // DIFFERENT DEFAULTS for the arguments:
-    size:     (which,emptyIsAName=true)=>capi.sqlite3_js_kvvfs_size(which,emptyIsAName),
-    clear:    (which,emptyIsAName=true)=>capi.sqlite3_js_kvvfs_clear(which,emptyIsAName),
+    size:     capi.sqlite3_js_kvvfs_size,
+    clear:    capi.sqlite3_js_kvvfs_clear
   });
 
+  if( sqlite3.__isUnderTest ){
+    /* For inspection via the dev tools console. */
+    sqlite3.kvvfs.test = {
+      pFileHandles,
+      cache
+    };
+  }
+
   if(sqlite3.oo1?.DB){
     /**
        Functionally equivalent to DB(storageName,'c','kvvfs') except
index d9d7430ed5561b62c05c885de24bcc6b28faf27d..b8870f46e13b661ec40970a3bc3af735a7c40336 100644 (file)
@@ -3021,6 +3021,7 @@ globalThis.sqlite3InitModule = sqlite3InitModule;
         T.mustThrowMatching(()=>{
           new JDb("012345678901234567890123"/*too long*/);
         }, capi.SQLITE_RANGE);
+        T.mustThrowMatching(()=>new JDb(""), capi.SQLITE_RANGE);
         {
           const name = "01234567890123456789012" /* max name length */;
           (new JDb(name)).close();
index 642f1872bf305659ced032ea020ccedf8b3f4699..4f89f10ece6df8b7385ca343affb4752fe75700b 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Improve\skvvfs\sfile\sname\svalidation.\sAdd\ssqlite3.kvvfs.unlink().
-D 2025-11-25T18:52:08.177
+C Remove\sthe\sostensible\ssupport\sfor\sempty\skvvfs\snames,\sas\sthose\snames\sapparently\snever\sreach\skvvfs.xOpen\s(the\sempty\sname\sis\sspecial).\sThat\sactually\ssimplifies\sthings\swith\sregards\sto\sbackwards\scompatibility.
+D 2025-11-25T19:05:13.106
 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
@@ -600,7 +600,7 @@ F ext/wasm/api/sqlite3-api-worker1.c-pp.js 1041dd645e8e821c082b628cd8d9acf70c667
 F ext/wasm/api/sqlite3-license-version-header.js 0c807a421f0187e778dc1078f10d2994b915123c1223fe752b60afdcd1263f89
 F ext/wasm/api/sqlite3-opfs-async-proxy.js 9654b565b346dc609b75d15337f20acfa7af7d9d558da1afeb9b6d8eaa404966
 F ext/wasm/api/sqlite3-vfs-helper.c-pp.js 3f828cc66758acb40e9c5b4dcfd87fd478a14c8fb7f0630264e6c7fa0e57515d
-F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js bd901a57c958a31bbbcaecdb7993467161f38e72b8b5e8c8eaaa898a078b85ea
+F ext/wasm/api/sqlite3-vfs-kvvfs.c-pp.js d61f11929fb1d115c47cf7bdd168229328cfe5bd91fd0faedebd90683c22f83c
 F ext/wasm/api/sqlite3-vfs-opfs-sahpool.c-pp.js a2eea6442556867b589e04107796c6e1d04a472219529eeb45b7cd221d7d048b
 F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 88ce2078267a2d1af57525a32d896295f4a8db7664de0e17e82dc9ff006ed8d3
 F ext/wasm/api/sqlite3-vtab-helper.c-pp.js 9097074724172e31e56ce20ccd7482259cf72a76124213cbc9469d757676da86
@@ -647,7 +647,7 @@ F ext/wasm/test-opfs-vfs.html 1f2d672f3f3fce810dfd48a8d56914aba22e45c6834e262555
 F ext/wasm/test-opfs-vfs.js 1618670e466f424aa289859fe0ec8ded223e42e9e69b5c851f809baaaca1a00c
 F ext/wasm/tester1-worker.c-pp.html 0e432ec2c0d99cd470484337066e8d27e7aee4641d97115338f7d962bf7b081a
 F ext/wasm/tester1.c-pp.html 52d88fe2c6f21a046030a36410b4839b632f4424028197a45a3d5669ea724ddb
-F ext/wasm/tester1.c-pp.js 87a6276e7f5970d5c6bd51a00972ee22230ada535793518b90f3524969592a56
+F ext/wasm/tester1.c-pp.js e224b2c827a40a915c8b8a68d12bfed1c8c8fce59f9722b28fc8993e1cdcc5e8
 F ext/wasm/tests/opfs/concurrency/index.html 657578a6e9ce1e9b8be951549ed93a6a471f4520a99e5b545928668f4285fb5e
 F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65ad09f510589c779b7cc6a803a88
 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
@@ -2178,8 +2178,8 @@ F tool/version-info.c 33d0390ef484b3b1cb685d59362be891ea162123cea181cb8e6d2cf6dd
 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7
 F tool/warnings.sh d924598cf2f55a4ecbc2aeb055c10bd5f48114793e7ba25f9585435da29e7e98
 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f
-P 02793c5905e6b99379cd5ad6bfe1eb6cccf839da081fc174dce7b06245e212fb
-R ed6be124fc5c288abe328108bd2f7a96
+P 0dfdf4681cf63541de971a20be21b33d0d3b38e8281f302d20aca9492df3da42
+R 89cd8bf5982ad483b1695fb89098bc74
 U stephan
-Z 630b67750a1abe72dfc01e3136fc3599
+Z 4bbc18df06e712b9f72a91bc732373ca
 # Remove this line to create a well-formed Fossil manifest.
index 0c5819bac04c98d88b40ec12569fd31d2c88c1ac..da11fc4d196046d242a766a2b151eba83feac9e6 100644 (file)
@@ -1 +1 @@
-0dfdf4681cf63541de971a20be21b33d0d3b38e8281f302d20aca9492df3da42
+a5c61fa56770a6fffcb4c76db2256c71b2d5f0beee6fc2c4800c40bf7ef995c8