/ Check-in [e8418588f2]
Login

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

Overview
Comment:If the xAccess() call used by "PRAGMA temp_store_directory = /new/path/" to determine if the supplied directory is writable returns an error, assume the directory is not writable. (CVS 5707)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: e8418588f2c23487cefda702849d4546202fd8ec
User & Date: danielk1977 2008-09-16 14:38:03
Context
2008-09-16
15:09
Add test script selectC.test which demonstrates ticket #3381. (CVS 5708) check-in: 3847faff55 user: drh tags: trunk
14:38
If the xAccess() call used by "PRAGMA temp_store_directory = /new/path/" to determine if the supplied directory is writable returns an error, assume the directory is not writable. (CVS 5707) check-in: e8418588f2 user: danielk1977 tags: trunk
12:06
Modify the sqlite3VdbeMemCompare() routine so that it does not modify any Mem.z values. Ticket #3376. (CVS 5706) check-in: 2d45055100 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/pragma.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.186 2008/09/02 15:44:09 danielk1977 Exp $
           14  +** $Id: pragma.c,v 1.187 2008/09/16 14:38:03 danielk1977 Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include <ctype.h>
    18     18   
    19     19   /* Ignore this whole file if pragmas are disabled
    20     20   */
    21     21   #if !defined(SQLITE_OMIT_PRAGMA) && !defined(SQLITE_OMIT_PARSER)
................................................................................
   664    664               "temp_store_directory", P4_STATIC);
   665    665           sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, sqlite3_temp_directory, 0);
   666    666           sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1);
   667    667         }
   668    668       }else{
   669    669   #ifndef SQLITE_OMIT_WSD
   670    670         if( zRight[0] ){
          671  +        int rc;
   671    672           int res;
   672         -        sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
   673         -        if( res==0 ){
          673  +        rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res);
          674  +        if( rc!=SQLITE_OK || res==0 ){
   674    675             sqlite3ErrorMsg(pParse, "not a writable directory");
   675    676             goto pragma_out;
   676    677           }
   677    678         }
   678    679         if( SQLITE_TEMP_STORE==0
   679    680          || (SQLITE_TEMP_STORE==1 && db->temp_store<=1)
   680    681          || (SQLITE_TEMP_STORE==2 && db->temp_store==1)

Changes to test/ioerr2.test.

    11     11   # This file implements regression tests for SQLite library.  The
    12     12   # focus of this file is testing for correct handling of I/O errors
    13     13   # such as writes failing because the disk is full.
    14     14   # 
    15     15   # The tests in this file use special facilities that are only
    16     16   # available in the SQLite test fixture.
    17     17   #
    18         -# $Id: ioerr2.test,v 1.9 2008/08/20 14:49:25 danielk1977 Exp $
           18  +# $Id: ioerr2.test,v 1.10 2008/09/16 14:38:04 danielk1977 Exp $
    19     19   
    20     20   set testdir [file dirname $argv0]
    21     21   source $testdir/tester.tcl
    22     22   
    23     23   ifcapable !integrityck {
    24     24     finish_test
    25     25     return
................................................................................
   127    127           set sql {UPDATE t2 SET b = randstr(400,400)}
   128    128           foreach {::go res} [catchsql $sql] {}
   129    129         }
   130    130       }
   131    131     } msg]
   132    132     list $rc $msg
   133    133   } {1 {callback requested query abort}}
          134  +
          135  +if {$::tcl_platform(platform) == "unix"} {
          136  +  # Cause the call to xAccess used by [pragma temp_store_directory] to
          137  +  # determine if the specified directory is writable to fail. This causes
          138  +  # SQLite to report "not a writable directory", which is probably the
          139  +  # right answer.
          140  +  #
          141  +  do_test ioerr2-6 {
          142  +    set ::sqlite_io_error_hit 0
          143  +    set ::sqlite_io_error_pending 1
          144  +    catchsql {PRAGMA temp_store_directory = '/tmp/'}
          145  +  } {1 {not a writable directory}}
          146  +}
   134    147   
   135    148   finish_test