]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Better error messages when trying to open a large file using a version
authordrh <drh@noemail.net>
Mon, 5 May 2008 16:56:34 +0000 (16:56 +0000)
committerdrh <drh@noemail.net>
Mon, 5 May 2008 16:56:34 +0000 (16:56 +0000)
of SQLite that omits large file support.  Tickets #3096 and #3094. (CVS 5085)

FossilOrigin-Name: bdd89cd231745e6bd498b2751d7ff2cf6169b3eb

manifest
manifest.uuid
src/main.c
src/os_unix.c
test/capi3.test
test/capi3c.test

index da80b8c90173972a2827e5276c902ec016a0ddb2..9183c48bb655cbfa522e779af46c026b9f7edef1 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Do\snot\ssegfault\sin\sthe\sCLI\sif\ssqlite3_open()\sfails\sto\screate\sa\ndatabase\sconnection\sobject.\s\sTicket\s#3096.\s(CVS\s5084)
-D 2008-05-05T16:27:24
+C Better\serror\smessages\swhen\strying\sto\sopen\sa\slarge\sfile\susing\sa\sversion\nof\sSQLite\sthat\somits\slarge\sfile\ssupport.\s\sTickets\s#3096\sand\s#3094.\s(CVS\s5085)
+D 2008-05-05T16:56:35
 F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
 F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@@ -103,7 +103,7 @@ F src/insert.c 77f0829b3e2edd19e9238195c56b0d56ab000f17
 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e
 F src/legacy.c 8267890e6a0a71f13b680794520999c642299081
 F src/loadext.c 48455156d6044141d7e332c1b0b4647b3b8b8e66
-F src/main.c d40ed2bf7b63002726b19951cae14d0bcf7debd9
+F src/main.c 4c9ac364c1022b31ce3310ee5899e73e4b53db38
 F src/malloc.c 12c1ae98ef1eff34b13c9eb526e0b7b479e1e820
 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
 F src/mem1.c fc716ff521b6dd3e43eaa211967383308800e70a
@@ -120,7 +120,7 @@ F src/os.c d811a3e1a152e03c98d3dd85f2b7aff0d7630cea
 F src/os.h 2ee8b0dec88f946c5371919ffa0f2fe4ac0de2e6
 F src/os_common.h e8b748b2f2ecc8a498e50bfe5d8721f189c19d2a
 F src/os_os2.c 41015b3fa91568761eb10cbf6ca27a0624ba0bda
-F src/os_unix.c 8cf512c4321c3114f053dc9eaae394db2dc03ebe
+F src/os_unix.c a810e2aefdaddacf479407f76f8f4ca381d231b2
 F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403
 F src/pager.c 5ac6728cf575afd87f8c5afe88bb768d3a641e34
 F src/pager.h 4f051fd856de6fd3c19aef5f82eace54122b9173
@@ -213,9 +213,9 @@ F test/blob.test 2a38d867bdf08f9ce081776acec1ac8d4bca66be
 F test/busy.test 76b4887f8b9160ba903c1ac22e8ff406ad6ae2f0
 F test/cache.test 3ff445c445742a7b6b9ba6e1d62a25263f9424b9
 F test/capi2.test cc64df7560a96f848f919ea2926c60acf639684b
-F test/capi3.test 8113010cd06a94b7ac72524858968069b7cac8e3
+F test/capi3.test 1ca5912fdd3a51ea8ee148742532c6a81724f594
 F test/capi3b.test 664eb55318132f292f2c436f90906f578cad6b97
-F test/capi3c.test c024e42d2341026ddffd79a7dd864c3555d06ccd
+F test/capi3c.test 208713e5f3a63442c3574c55b83baa7cf8ac5f28
 F test/cast.test ce8f14fc80f70b30ed984480cc0d8914a459e8f9
 F test/check.test 024ed399600b799160378cf9d9f436bdf5dfd184
 F test/collate1.test e3eaa48c21e150814be1a7b852d2a8af24458d04
@@ -634,7 +634,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 4ad1809192b616d1c12499825bcd0967dea76864
-R bfbe4f20e4711eac7660528cdf81900f
+P 0bec7ebf41e9f52d3ef0449e27e3d631abfe948b
+R 720ec4e53fc1d1f5a57067d1318be9aa
 U drh
-Z 282ac40d5061e73766d751c019b02dae
+Z 82d70374903017357999aa8ebaf9b26f
index 48f0fb78cf09fa52d4def937509aee768275320b..b9a035ae5732b2b41a4ac84f807d0d7205934b04 100644 (file)
@@ -1 +1 @@
-0bec7ebf41e9f52d3ef0449e27e3d631abfe948b
\ No newline at end of file
+bdd89cd231745e6bd498b2751d7ff2cf6169b3eb
\ No newline at end of file
index 2ed200b06e707cfa97893b63cc509ea680540431..668db1255f3e6f15f985b437a71252e85b33c260 100644 (file)
@@ -14,7 +14,7 @@
 ** other files are for internal use by SQLite and should not be
 ** accessed by users of the library.
 **
-** $Id: main.c,v 1.437 2008/05/01 17:03:49 drh Exp $
+** $Id: main.c,v 1.438 2008/05/05 16:56:35 drh Exp $
 */
 #include "sqliteInt.h"
 #include <ctype.h>
@@ -306,7 +306,7 @@ const char *sqlite3ErrStr(int rc){
     case SQLITE_CONSTRAINT: z = "constraint failed";                     break;
     case SQLITE_MISMATCH:   z = "datatype mismatch";                     break;
     case SQLITE_MISUSE:     z = "library routine called out of sequence";break;
-    case SQLITE_NOLFS:      z = "kernel lacks large file support";       break;
+    case SQLITE_NOLFS:      z = "large file support is disabled";        break;
     case SQLITE_AUTH:       z = "authorization denied";                  break;
     case SQLITE_FORMAT:     z = "auxiliary database format error";       break;
     case SQLITE_RANGE:      z = "bind or column index out of range";     break;
index ca1f20b9992eb58ec059262a1de5bae9fd43789b..f5bc4907721bf6fa74f02d2871f76a00772b0acf 100644 (file)
@@ -617,7 +617,7 @@ static sqlite3LockingStyle sqlite3DetectLockingStyle(
 ** describes that file descriptor.  Create new ones if necessary.  The
 ** return values might be uninitialized if an error occurs.
 **
-** Return the number of errors.
+** Return an appropriate error code.
 */
 static int findLockInfo(
   int fd,                      /* The file descriptor used in the key */
@@ -631,7 +631,12 @@ static int findLockInfo(
   struct lockInfo *pLock;
   struct openCnt *pOpen;
   rc = fstat(fd, &statbuf);
-  if( rc!=0 ) return 1;
+  if( rc!=0 ){
+#ifdef EOVERFLOW
+    if( errno==EOVERFLOW ) return SQLITE_NOLFS;
+#endif
+    return SQLITE_IOERR;
+  }
 
   memset(&key1, 0, sizeof(key1));
   key1.dev = statbuf.st_dev;
@@ -650,7 +655,7 @@ static int findLockInfo(
     struct lockInfo *pOld;
     pLock = sqlite3_malloc( sizeof(*pLock) );
     if( pLock==0 ){
-      rc = 1;
+      rc = SQLITE_NOMEM;
       goto exit_findlockinfo;
     }
     pLock->key = key1;
@@ -661,7 +666,7 @@ static int findLockInfo(
     if( pOld!=0 ){
       assert( pOld==pLock );
       sqlite3_free(pLock);
-      rc = 1;
+      rc = SQLITE_NOMEM;
       goto exit_findlockinfo;
     }
   }else{
@@ -675,7 +680,7 @@ static int findLockInfo(
       pOpen = sqlite3_malloc( sizeof(*pOpen) );
       if( pOpen==0 ){
         releaseLockInfo(pLock);
-        rc = 1;
+        rc = SQLITE_NOMEM;
         goto exit_findlockinfo;
       }
       pOpen->key = key2;
@@ -688,7 +693,7 @@ static int findLockInfo(
         assert( pOld==pOpen );
         sqlite3_free(pOpen);
         releaseLockInfo(pLock);
-        rc = 1;
+        rc = SQLITE_NOMEM;
         goto exit_findlockinfo;
       }
     }else{
@@ -2189,7 +2194,7 @@ static int fillInUnixFile(
     if( rc ){
       if( dirfd>=0 ) close(dirfd);
       close(h);
-      return SQLITE_NOMEM;
+      return rc;
     }
   } else {
     /*  pLock and pOpen are only used for posix advisory locking */
@@ -2278,7 +2283,7 @@ static int fillInUnixFile(
   if( rc ){
     if( dirfd>=0 ) close(dirfd);
     close(h);
-    return SQLITE_NOMEM;
+    return rc;
   }
 
   OSTRACE3("OPEN    %-3d %s\n", h, zFilename);
index 09a33370def33d68f828e69008cfb9905d5f1418..c466039b04550c1bf6ac0c984d631115115a290e 100644 (file)
@@ -11,7 +11,7 @@
 # This file implements regression tests for SQLite library.  The
 # focus of this script testing the callback-free C/C++ API.
 #
-# $Id: capi3.test,v 1.62 2008/04/03 14:36:26 danielk1977 Exp $
+# $Id: capi3.test,v 1.63 2008/05/05 16:56:35 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -749,7 +749,7 @@ SQLITE_SCHEMA     {database schema has changed} \
 SQLITE_CONSTRAINT {constraint failed} \
 SQLITE_MISMATCH   {datatype mismatch} \
 SQLITE_MISUSE     {library routine called out of sequence} \
-SQLITE_NOLFS      {kernel lacks large file support} \
+SQLITE_NOLFS      {large file support is disabled} \
 SQLITE_AUTH       {authorization denied} \
 SQLITE_FORMAT     {auxiliary database format error} \
 SQLITE_RANGE      {bind or column index out of range} \
index c22fb68d3be3539d02aadf19a2b3060d38808a71..cf1a6a99a78f3d39d21d0dd41054809e91dc0ecf 100644 (file)
@@ -13,7 +13,7 @@
 # This is a copy of the capi3.test file that has been adapted to
 # test the new sqlite3_prepare_v2 interface.
 #
-# $Id: capi3c.test,v 1.18 2008/04/15 12:14:22 drh Exp $
+# $Id: capi3c.test,v 1.19 2008/05/05 16:56:35 drh Exp $
 #
 
 set testdir [file dirname $argv0]
@@ -722,7 +722,7 @@ SQLITE_SCHEMA     {database schema has changed} \
 SQLITE_CONSTRAINT {constraint failed} \
 SQLITE_MISMATCH   {datatype mismatch} \
 SQLITE_MISUSE     {library routine called out of sequence} \
-SQLITE_NOLFS      {kernel lacks large file support} \
+SQLITE_NOLFS      {large file support is disabled} \
 SQLITE_AUTH       {authorization denied} \
 SQLITE_FORMAT     {auxiliary database format error} \
 SQLITE_RANGE      {bind or column index out of range} \