--- Zbigniew Baniewski <[EMAIL PROTECTED]> wrote: > On Thu, Jul 26, 2007 at 08:11:22AM -0700, Joe Wilson wrote: > > > Try > > > > PRAGMA temp_store_directory = 'directory-name'; > > > > Otherwise, the temp file location order for UNIX is: > > > > "/var/tmp", > > "/usr/tmp", > > "/tmp", > > ".", > > Thanks, I'll try to. Although is rather temporar workaround than solution, > because there's a need to set it at every database connection. > > As I can see, the order, in which sqlite is searching the "temp" > directories, is like the above. Someone from other list wrote, that sqlite > doesn't like, when "any directory in the database path isn't writeable" (is > it true?) - perhaps the same thing is related to any "temp" directory? Under > NetBSD there are /var/tmp and /tmp directories - but, of course, /var doesn't > have 777 (both /var/tmp and /tmp do). Perhaps this can make a problem?
/var on my machine is drwxr-xr-x, and I don't have any issues with sqlite reading and writing temp files to /var/tmp/. Even if the permissions of /var were d--x--x--x, it would also be fine. As long as /var/tmp is rwx for the sqlite process, it will work. Just make sure the the first accessible temp dir has enough disk space for the temporary files. > If so - shouldn't be much more logical, to change the order of search to: > > 1. /tmp > 2. /var/tmp > 3. /usr/tmp > 4. . > > In such way, on the first place could be the only one directory, which is > always (if it does exist at all) both world-writeable and hasn't any > parent-dir, which can be not set to 777. Wouldn't it be a "final solution" > of the problem? The function in question is in os_unix.c. You can change the temp dir list's order, or hard-code a preferred temp directory if you like: int sqlite3UnixTempFileName(char *zBuf){ static const char *azDirs[] = { 0, "/var/tmp", "/usr/tmp", "/tmp", ".", }; static const unsigned char zChars[] = "abcdefghijklmnopqrstuvwxyz" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "0123456789"; int i, j; struct stat buf; const char *zDir = "."; azDirs[0] = sqlite3_temp_directory; for(i=0; i<sizeof(azDirs)/sizeof(azDirs[0]); i++){ if( azDirs[i]==0 ) continue; if( stat(azDirs[i], &buf) ) continue; if( !S_ISDIR(buf.st_mode) ) continue; if( access(azDirs[i], 07) ) continue; zDir = azDirs[i]; break; } do{ sqlite3_snprintf(SQLITE_TEMPNAME_SIZE, zBuf, "%s/"TEMP_FILE_PREFIX, zDir); j = strlen(zBuf); sqlite3Randomness(15, &zBuf[j]); for(i=0; i<15; i++, j++){ zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; } zBuf[j] = 0; }while( access(zBuf,0)==0 ); return SQLITE_OK; } ____________________________________________________________________________________ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz ----------------------------------------------------------------------------- To unsubscribe, send email to [EMAIL PROTECTED] -----------------------------------------------------------------------------