/ Check-in [8088031b]
Login
SQLite training in Houston TX on 2019-11-05 (details)
Part of the 2019 Tcl Conference

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

Overview
Comment:Fix some problems in os_unix.c when compiled with ENABLE_LOCKING_STYLE on OSX. Also some minor issues with test scripts.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8088031bc949bd4efb5edf33bbd1bce5700fca56
User & Date: dan 2011-04-01 09:04:37
Context
2011-04-01
11:56
In os_unix.c, do not return SQLITE_BUSY to SQLite following an error in fcntl(F_UNLCK), regardless of the value of errno. check-in: ff6dfe6e user: dan tags: trunk
09:04
Fix some problems in os_unix.c when compiled with ENABLE_LOCKING_STYLE on OSX. Also some minor issues with test scripts. check-in: 8088031b user: dan tags: trunk
02:26
Fix two compiler errors associated with non-standard compile-time options. check-in: e3bf2d5c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

install-sh became executable.


Changes to src/os_unix.c.

  1590   1590         if( handleNFSUnlock ){
  1591   1591           off_t divSize = SHARED_SIZE - 1;
  1592   1592           
  1593   1593           lock.l_type = F_UNLCK;
  1594   1594           lock.l_whence = SEEK_SET;
  1595   1595           lock.l_start = SHARED_FIRST;
  1596   1596           lock.l_len = divSize;
  1597         -        if( unixFileLock(pFile,, &lock)==(-1) ){
         1597  +        if( unixFileLock(pFile, &lock)==(-1) ){
  1598   1598             tErrno = errno;
  1599   1599             rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK);
  1600   1600             if( IS_LOCK_ERROR(rc) ){
  1601   1601               pFile->lastErrno = tErrno;
  1602   1602             }
  1603   1603             goto end_unlock;
  1604   1604           }
................................................................................
  5743   5743     pNew = (unixFile *)sqlite3_malloc(sizeof(*pNew));
  5744   5744     if( pNew==NULL ){
  5745   5745       rc = SQLITE_NOMEM;
  5746   5746       goto end_create_proxy;
  5747   5747     }
  5748   5748     memset(pNew, 0, sizeof(unixFile));
  5749   5749     pNew->openFlags = openFlags;
         5750  +  memset(&dummyVfs, 0, sizeof(dummyVfs));
  5750   5751     dummyVfs.pAppData = (void*)&autolockIoFinder;
         5752  +  dummyVfs.zName = "dummy";
  5751   5753     pUnused->fd = fd;
  5752   5754     pUnused->flags = openFlags;
  5753   5755     pNew->pUnused = pUnused;
  5754   5756     
  5755   5757     rc = fillInUnixFile(&dummyVfs, fd, dirfd, (sqlite3_file*)pNew, path, 0, 0, 0);
  5756   5758     if( rc==SQLITE_OK ){
  5757   5759       *ppFile = pNew;

Changes to src/test_hexio.c.

   308    308     z = sqlite3_malloc( n+3 );
   309    309     n = sqlite3TestHexToBin(zOrig, n, z);
   310    310     z[n] = 0;
   311    311     nOut = sqlite3Utf8To8(z);
   312    312     sqlite3TestBinToHex(z,nOut);
   313    313     Tcl_AppendResult(interp, (char*)z, 0);
   314    314     sqlite3_free(z);
   315         -#endif
   316    315     return TCL_OK;
          316  +#else
          317  +  Tcl_AppendResult(interp, 
          318  +      "[utf8_to_utf8] unavailable - SQLITE_DEBUG not defined", 0
          319  +  );
          320  +  return TCL_ERROR;
          321  +#endif
   317    322   }
   318    323   
   319    324   static int getFts3Varint(const char *p, sqlite_int64 *v){
   320    325     const unsigned char *q = (const unsigned char *) p;
   321    326     sqlite_uint64 x = 0, y = 1;
   322    327     while( (*q & 0x80) == 0x80 ){
   323    328       x += y * (*q++ & 0x7f);

Changes to test/badutf2.test.

   101    101     do_test badutf2-4.1.$i {
   102    102       sqlite3_reset $S
   103    103       sqlite3_bind_text $S 1 $xstr $len
   104    104       sqlite3_step $S
   105    105       utf8_to_ustr2 [ sqlite3_column_text $S 0 ]
   106    106     } $ustr
   107    107   
   108         -  do_test badutf2-5.1.$i {
   109         -    utf8_to_utf8 $uval
   110         -  } $u2u
          108  +  ifcapable debug {
          109  +    do_test badutf2-5.1.$i {
          110  +      utf8_to_utf8 $uval
          111  +    } $u2u
          112  +  }
   111    113   
   112    114   }
   113    115   
   114    116   do_test badutf2-4.2 {
   115    117     sqlite3_finalize $S
   116    118   } {SQLITE_OK}
   117    119   
   118    120   
   119    121   finish_test

Changes to test/oserror.test.

    40     40     
    41     41   }
    42     42   
    43     43   #--------------------------------------------------------------------------
    44     44   # Tests oserror-1.* test failures in the open() system call.
    45     45   #
    46     46   
    47         -# Test a failure in open() due to too many files.
           47  +# Test a failure in open() due to too many files. 
           48  +#
           49  +# The xOpen() method of the unix VFS calls getcwd() as well as open().
           50  +# Although this does not appear to be documented in the man page, on OSX
           51  +# a call to getcwd() may fail if there are no free file descriptors. So
           52  +# an error may be reported for either open() or getcwd() here.
    48     53   #
    49     54   do_test 1.1.1 {
    50     55     set ::log [list]
    51     56     list [catch {
    52     57       for {set i 0} {$i < 2000} {incr i} { sqlite3 dbh_$i test.db -readonly 1 }
    53     58     } msg] $msg
    54     59   } {1 {unable to open database file}}
    55     60   do_test 1.1.2 {
    56     61     catch { for {set i 0} {$i < 2000} {incr i} { dbh_$i close } }
    57     62   } {1}
    58         -
    59         -do_re_test 1.1.3 { lindex $::log 0 } {^os_unix.c:\d+: \(\d+\) open\(.*test.db\) - }
           63  +do_re_test 1.1.3 { 
           64  +  lindex $::log 0 
           65  +} {^os_unix.c:\d+: \(\d+\) (open|getcwd)\(.*test.db\) - }
    60     66   
    61     67   
    62     68   # Test a failure in open() due to the path being a directory.
    63     69   #
    64     70   do_test 1.2.1 {
    65     71     file mkdir dir.db
    66     72     set ::log [list]

test/progress.test became a regular file.


tool/mkopts.tcl became a regular file.