Package: libsqlite3-tcl
Version: 3.7.13-1+deb7u1
Severity: normal
Dear Maintainer,
In attempt to implement concurrent access to a db file, there is a
circumstance where a db has been closed, and yet the database remains
locked. A minimal code example is below.
Note that the example herein probably demonstrates a bad approach.
But nonetheless, db close command should either be executed or it
should fail loudly.
This script shows a silent failure of the close command:
====8<----------------------------------------
#!/usr/bin/tclsh8.5
package require sqlite3
set script_basename [lindex [file split [info script]] end]
regsub -all -- {[[:punct:]]} $script_basename {_} script_id
set db_filename [exec mktemp --tmpdir=/tmp --suffix=.db ${script_id}_XXX]
proc init_db {} {
global db_filename
sqlite3 my_db $db_filename
my_db timeout 3000
}
init_db
my_db eval {create table if not exists my_tbl (bank text not null
primary key,
party_supported text,
bailed_out text,
supports_cispa text)}
my_db eval {insert into my_tbl (bank) values ('bank of america')}
my_db eval {insert into my_tbl (bank) values ('chase')}
my_db eval {insert into my_tbl (bank) values ('citibank')}
my_db eval {insert into my_tbl (bank) values ('pnc')}
my_db eval {insert into my_tbl (bank) values ('suntrust')}
my_db eval {select bank from my_tbl where party_supported is null} {
my_db eval {update my_tbl set party_supported = 'republican' where bank =
$bank}
my_db eval {update my_tbl set bailed_out = 'true' where bank =
$bank}
my_db eval {update my_tbl set supports_cispa = 'true' where bank =
$bank}
# Closing the db is perhaps a bad idea at this point given that we
# are inside of a query operation. Regardless, it should probably
# abort with a meaningful error. It should not close with locks
# still in place, thus creating opportunity for catastrophies.
my_db close; #give other db users a chance to gain access
after 1000; #make the db available for other users for 1 second
init_db; #take back the db
}
====8<----------------------------------------
-- System Information:
Debian Release: 7.4
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 3.2.0-4-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages libsqlite3-tcl depends on:
ii libc6 2.13-38+deb7u1
ii libsqlite3-0 3.7.13-1+deb7u1
libsqlite3-tcl recommends no packages.
Versions of packages libsqlite3-tcl suggests:
pn sqlite3-doc <none>
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]