SQLite

Check-in [416c9efb49]
Login

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

Overview
Comment:Fix a couple of problems in test file test_journal.c that were causing segfaults when running all.test. (CVS 6063)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 416c9efb49ba207a9a79d06d0b13854695a8876c
User & Date: danielk1977 2008-12-24 09:30:22.000
Context
2008-12-24
11:25
Fix a virtual table related assert() that can fail following a malloc failure. (CVS 6064) (check-in: c6fd3b8f29 user: danielk1977 tags: trunk)
09:30
Fix a couple of problems in test file test_journal.c that were causing segfaults when running all.test. (CVS 6063) (check-in: 416c9efb49 user: danielk1977 tags: trunk)
2008-12-23
23:56
Continuing improvements to the multi-index OR-clause optimizer. Added a few simple test cases. (CVS 6062) (check-in: 55d4f493e7 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/test_journal.c.
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
** bug in SQLite - writing data to a database file page when:
**
**   a) the original page data is not stored in a synced portion of the
**      journal file, and
**   b) the page was not a free-list leaf page when the transaction was
**      first opened.
**
** $Id: test_journal.c,v 1.2 2008/12/22 10:58:46 danielk1977 Exp $
*/
#if SQLITE_TEST          /* This file is used for testing only */

#include "sqlite3.h"
#include "sqliteInt.h"

/*







|







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
** bug in SQLite - writing data to a database file page when:
**
**   a) the original page data is not stored in a synced portion of the
**      journal file, and
**   b) the page was not a free-list leaf page when the transaction was
**      first opened.
**
** $Id: test_journal.c,v 1.3 2008/12/24 09:30:22 danielk1977 Exp $
*/
#if SQLITE_TEST          /* This file is used for testing only */

#include "sqlite3.h"
#include "sqliteInt.h"

/*
323
324
325
326
327
328
329

330

331
332
333
334
335
336
337
    }
    for(ii=0; rc==SQLITE_OK && ii<nRec && iOff<iSize; ii++){
      u32 pgno;
      rc = sqlite3OsRead(pReal, zBuf, 4, iOff);
      if( rc==SQLITE_OK ){
        pgno = decodeUint32(zBuf);
        iOff += (8 + pMain->nPagesize);

        sqlite3BitvecSet(pMain->pWritable, pgno);

      }
    }

    iOff = ((iOff + (nSector-1)) / nSector) * nSector;
  }

  return rc;







>
|
>







323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
    }
    for(ii=0; rc==SQLITE_OK && ii<nRec && iOff<iSize; ii++){
      u32 pgno;
      rc = sqlite3OsRead(pReal, zBuf, 4, iOff);
      if( rc==SQLITE_OK ){
        pgno = decodeUint32(zBuf);
        iOff += (8 + pMain->nPagesize);
        if( pgno>0 && pgno<=pMain->nPage ){
          sqlite3BitvecSet(pMain->pWritable, pgno);
        }
      }
    }

    iOff = ((iOff + (nSector-1)) / nSector) * nSector;
  }

  return rc;
442
443
444
445
446
447
448

449
450

451
452
453
454
455
456
457
  sqlite3_file *pFile,
  int flags,
  int *pOutFlags
){
  int rc;
  jt_file *p = (jt_file *)pFile;
  p->pReal = (sqlite3_file *)&p[1];

  rc = sqlite3OsOpen(g.pVfs, zName, p->pReal, flags, pOutFlags);
  if( p->pReal->pMethods ){

    pFile->pMethods = &jt_io_methods;
    p->eLock = 0;
    p->zName = zName;
    p->flags = flags;
    p->pNext = 0;
    p->pWritable = 0;
    if( zName ){







>

|
>







444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
  sqlite3_file *pFile,
  int flags,
  int *pOutFlags
){
  int rc;
  jt_file *p = (jt_file *)pFile;
  p->pReal = (sqlite3_file *)&p[1];
  p->pReal->pMethods = 0;
  rc = sqlite3OsOpen(g.pVfs, zName, p->pReal, flags, pOutFlags);
  assert( rc==SQLITE_OK || p->pReal->pMethods==0 );
  if( rc==SQLITE_OK ){
    pFile->pMethods = &jt_io_methods;
    p->eLock = 0;
    p->zName = zName;
    p->flags = flags;
    p->pNext = 0;
    p->pWritable = 0;
    if( zName ){