/ Check-in [b8b7b8f9]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change the way the tcl crash-test code works to avoid triggering an assert() in os_unix.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b8b7b8f9e97a5c34f0f199b46347e0bf85005a4d
User & Date: dan 2012-10-17 15:28:26
Context
2012-10-17
16:20
Add a test for the problem fixed by [bf44d73d3e]. check-in: db9b1fa5 user: dan tags: trunk
15:28
Change the way the tcl crash-test code works to avoid triggering an assert() in os_unix.c. check-in: b8b7b8f9 user: dan tags: trunk
13:15
Remove an incorrect "#ifndef SQLITE_OMIT_AUTOVACUUM" from pager. check-in: bf44d73d user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/test6.c.

   624    624       pWrapper->nData = (4096 + pWrapper->iSize);
   625    625       pWrapper->zData = crash_malloc(pWrapper->nData);
   626    626       if( pWrapper->zData ){
   627    627         /* os_unix.c contains an assert() that fails if the caller attempts
   628    628         ** to read data from the 512-byte locking region of a file opened
   629    629         ** with the SQLITE_OPEN_MAIN_DB flag. This region of a database file
   630    630         ** never contains valid data anyhow. So avoid doing such a read here.
          631  +      **
          632  +      ** UPDATE: It also contains an assert() verifying that each call
          633  +      ** to the xRead() method reads less than 128KB of data.
   631    634         */
   632    635         const int isDb = (flags&SQLITE_OPEN_MAIN_DB);
   633         -      i64 iChunk = pWrapper->iSize;
   634         -      if( iChunk>PENDING_BYTE && isDb ){
   635         -        iChunk = PENDING_BYTE;
   636         -      }
          636  +      i64 iOff;
          637  +
   637    638         memset(pWrapper->zData, 0, pWrapper->nData);
   638         -      rc = sqlite3OsRead(pReal, pWrapper->zData, (int)iChunk, 0); 
   639         -      if( SQLITE_OK==rc && pWrapper->iSize>(PENDING_BYTE+512) && isDb ){
   640         -        i64 iOff = PENDING_BYTE+512;
   641         -        iChunk = pWrapper->iSize - iOff;
   642         -        rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], (int)iChunk, iOff);
          639  +      for(iOff=0; iOff<pWrapper->iSize; iOff += 512){
          640  +        int nRead = pWrapper->iSize - iOff;
          641  +        if( nRead>512 ) nRead = 512;
          642  +        if( isDb && iOff==PENDING_BYTE ) continue;
          643  +        rc = sqlite3OsRead(pReal, &pWrapper->zData[iOff], nRead, iOff);
   643    644         }
   644    645       }else{
   645    646         rc = SQLITE_NOMEM;
   646    647       }
   647    648     }
   648    649     if( rc!=SQLITE_OK && pWrapper->pMethod ){
   649    650       sqlite3OsClose(pFile);