SQLite

Check-in [9f452514d9]
Login

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

Overview
Comment:Fix an assert() failure in wal2.test caused by messing with the contents of shared memory.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9f452514d96ab8d424eadc55c283c53fe831476d
User & Date: dan 2010-07-14 18:10:03.000
Context
2010-07-14
18:24
Make the result of an IN or NOT IN expression with an empty set on the right-hand side always either false or true, respectively, even if the left-hand side is NULL. Ticket [80e031a00f45dc] (check-in: c288ac644d user: drh tags: trunk)
18:10
Fix an assert() failure in wal2.test caused by messing with the contents of shared memory. (check-in: 9f452514d9 user: dan tags: trunk)
16:37
Test the libraries response to read-only or unreadable database, WAL and wal-index files. If a WAL file cannot be opened in read/write mode, return SQLITE_CANTOPEN to the caller. (check-in: 45bb84c628 user: dan tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to test/wal2.test.
975
976
977
978
979
980
981















982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
  }
} {wal 1 2 3 4 5 6 7 8 9}

do_test wal2-11.1.1 {
  sqlite3 db2 test.db
  execsql { SELECT name FROM sqlite_master } db2
} {t1}
















# Fill up the hash table on the first page of shared memory with 0x55 bytes.
#
set blob [string range [tvfs shm $::filename] 0 16383]
append blob [string repeat [binary format c 0x55] 16384]
tvfs shm $::filename $blob

do_test wal2-11.2 {
  catchsql { SELECT * FROM t1 } db2
} {1 {database disk image is malformed}}

do_test wal2-12.1 {
  catchsql { INSERT INTO t1 VALUES(10, 11, 12) }
} {1 {database disk image is malformed}}

db close
db2 close
tvfs delete

#-------------------------------------------------------------------------
# If a connection is required to create a WAL or SHM file, it creates 
# the new files with the same file-system permissions as the database 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




|

<
|



<
<
<
<







975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002

1003
1004
1005
1006




1007
1008
1009
1010
1011
1012
1013
  }
} {wal 1 2 3 4 5 6 7 8 9}

do_test wal2-11.1.1 {
  sqlite3 db2 test.db
  execsql { SELECT name FROM sqlite_master } db2
} {t1}

# Set all zeroed slots in the first hash table to invalid values.
#
set blob [string range [tvfs shm $::filename] 0 16383]
set I [string range [tvfs shm $::filename] 16384 end]
binary scan $I t* L
set I [list]
foreach p $L {
  lappend I [expr $p ? $p : 400]
}
append blob [binary format t* $I]
tvfs shm $::filename $blob
do_test wal2-11.2 {
  catchsql { INSERT INTO t1 VALUES(10, 11, 12) }
} {1 {database disk image is malformed}}

# Fill up the hash table on the first page of shared memory with 0x55 bytes.
#
set blob [string range [tvfs shm $::filename] 0 16383]
append blob [string repeat [binary format c 55] 16384]
tvfs shm $::filename $blob

do_test wal2-11.3 {
  catchsql { SELECT * FROM t1 } db2
} {1 {database disk image is malformed}}





db close
db2 close
tvfs delete

#-------------------------------------------------------------------------
# If a connection is required to create a WAL or SHM file, it creates 
# the new files with the same file-system permissions as the database