On 8/16/2012 12:41 AM, Achim Gratz wrote: > $ sqlite3 > SQLite version 3.7.13 2012-06-11 02:05:22 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> CREATE TEMP TABLE two (id INTEGER NOT NULL, name CHAR(64) NOT NULL ); > Error: unable to open database file > sqlite> > > Since I can't reproduce the problem in the debugger anymore, it will be > difficult to impossible to find out what's causing this (at least for me). > Just > like the problem with TortoiseSVN these are indications IMHO that there's a > race > somewhere between calls from the Cygwin DLL and Windows file locking > functions. > I can't rule out BLODA either.
I found the problem: sqlite is trying to create temporary files in the Windows directory. It's doing that because the internal "getTempname" function is scanning the Windows environment table for TMP and TEMP, and (because Cygwin hasn't synchronized the Windows environment with the Cygwin one) doesn't find a temporary directory, falling back to C:\Windows. You don't see the problem under the debugger or under strace because both tools synchronize the Windows environment with the Cygwin one before starting SQLite. You can work around the problem by synchronizing the environment yourself using cygwin_internal (CW_SYNC_WINENV) or by explicitly telling SQLite where it should store its temporary files using 'PRAGMA temp_store_directory="/tmp";'.
signature.asc
Description: OpenPGP digital signature