System.Data.SQLite
Check-in [5c2462c16b]
Not logged in

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

Overview
Comment:Prepare for the proposed hash algorithm changes in Fossil 2.0.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | fossil-2.0
Files: files | file ages | folders
SHA1: 5c2462c16b288b44a17d3c40f0b008b5b9c77f79
User & Date: mistachkin 2017-02-27 17:56:25
Context
2017-03-08
03:41
Partially reverse changes from the previous check-in on this branch because Fossil 2.x is going to return the first 40 characters of SHA3 hashes. Closed-Leaf check-in: 0e121167b8 user: mistachkin tags: fossil-2.0
2017-02-27
17:56
Prepare for the proposed hash algorithm changes in Fossil 2.0. check-in: 5c2462c16b user: mistachkin tags: fossil-2.0
17:20
Make PATH handling more robust in the batch tools for MSBuild. check-in: d9a9e08362 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Setup/updateFileInfo.tcl.

    32     32     #       decimal.
    33     33     #
    34     34     return [format %.2f [expr {[file size $fileName] / 1048576.0}]]
    35     35   }
    36     36   
    37     37   proc getFileHash { fileName } {
    38     38     #
    39         -  # NOTE: Return the SHA1 hash of the file, making use of Fossil via [exec] to
           39  +  # NOTE: Return the SHA3 hash of the file, making use of Fossil via [exec] to
    40     40     #       actually calculate it.
    41     41     #
    42         -  return [string trim [lindex [regexp -inline -nocase -- {[0-9A-F]{40} } \
    43         -      [exec fossil sha1sum $fileName]] 0]]
           42  +  return [string trim [lindex [regexp -inline -nocase -- {[0-9A-F]{56} } \
           43  +      [exec fossil sha3sum $fileName]] 0]]
    44     44   }
    45     45   
    46     46   #
    47     47   # NOTE: Grab the fully qualified directory name of the directory containing
    48     48   #       this script file.
    49     49   #
    50     50   set path [file normalize [file dirname [info script]]]
................................................................................
    81     81       [string length $outputDirectory] == 0} then {
    82     82     set outputDirectory [file join $path Output]
    83     83   }
    84     84   
    85     85   #
    86     86   # NOTE: Setup the regular expression patterns with the necessary captures.
    87     87   #       These patterns are mostly non-greedy; however, at the end we need to
    88         -#       match exactly 40 hexadecimal characters.  In theory, in Tcl, this could
           88  +#       match exactly 56 hexadecimal characters.  In theory, in Tcl, this could
    89     89   #       have an undefined result due to the mixing of greedy and non-greedy
    90     90   #       quantifiers; however, in practice, this seems to work properly.  Also,
    91     91   #       this pattern assumes a particular structure for the [HTML] file to be
    92     92   #       updated.
    93     93   #
    94     94   set pattern1 {<a\
    95         -    href=".*?/(.*?\.(?:exe|zip|nupkg))">.*?\((\d+?\.\d+?) MiB\).*?sha1:\
    96         -    ([0-9A-F]{40})}
           95  +    href=".*?/(.*?\.(?:exe|zip|nupkg))">.*?\((\d+?\.\d+?) MiB\).*?sha3:\
           96  +    ([0-9A-F]{56})}
    97     97   
    98     98   set pattern2 {<a\
    99     99       href=".*?/package/.*?/\d+\.\d+\.\d+\.\d+">(.*?)</a>.*?\((\d+?\.\d+?)\
   100         -    MiB\).*?sha1: ([0-9A-F]{40})}
          100  +    MiB\).*?sha3: ([0-9A-F]{56})}
   101    101   
   102    102   set pattern3 {href="/downloads/(.*?)"}
   103         -set pattern4 {\(sha1: ([0-9A-F]{40})\)}
          103  +set pattern4 {\(sha3: ([0-9A-F]{56})\)}
   104    104   set pattern5 {\((\d+?\.\d+?) MiB\)}
   105    105   
   106    106   #
   107    107   # NOTE: Grab all the data from the file to be updated.
   108    108   #
   109    109   set data [readFile $updateFileName]
   110    110   
................................................................................
   181    181   
   182    182         incr start [string length $fileHash]
   183    183       }
   184    184     }
   185    185   }
   186    186   
   187    187   #
   188         -# NOTE: Attempt to verify that each file name now has the correct SHA1 hash
          188  +# NOTE: Attempt to verify that each file name now has the correct SHA3 hash
   189    189   #       associated with it on the page.
   190    190   #
   191    191   foreach {dummy3 fileName} [regexp -all -inline -nocase -- $pattern3 $data] \
   192    192           {dummy4 fileHash} [regexp -all -inline -nocase -- $pattern4 $data] \
   193    193           {dummy5 fileSize} [regexp -all -inline -nocase -- $pattern5 $data] {
   194    194     #
   195    195     # NOTE: Get the fully qualified file name based on the configured
................................................................................
   208    208     #
   209    209     # NOTE: Make sure the file hash from the [modified] data matches the
   210    210     #       calculated hash for the file.  If not, fail.
   211    211     #
   212    212     set fullFileHash [getFileHash $fullFileName]
   213    213   
   214    214     if {$fileHash ne $fullFileHash} then {
   215         -    puts stdout "ERROR: SHA1 hash mismatch for\
          215  +    puts stdout "ERROR: SHA3 hash mismatch for\
   216    216           file \"$fullFileName\", have \"$fileHash\" (from data),\
   217    217           need \"$fullFileHash\" (calculated)."
   218    218     }
   219    219   
   220    220     set fullFileSize [getFileSize $fullFileName]
   221    221   
   222    222     if {$fileSize ne $fullFileSize} then {

Changes to Setup/verify.eagle.

    37     37       if {[string range $line 0 1] eq "F "} then {
    38     38         set fields [split $line " "]
    39     39   
    40     40         if {[llength $fields] >= 3} then {
    41     41           set fileName [string map [list \\s " "] [lindex $fields 1]]
    42     42           set hash [lindex $fields 2]
    43     43   
    44         -        if {[regexp -- {[0-9a-f]{40}} $hash]} then {
           44  +        if {[regexp -- {[0-9a-f]{40}} $hash] || \
           45  +            [regexp -- {[0-9a-f]{56}} $hash]} then {
    45     46             set hashes($fileName) $hash; incr result
    46     47           }
    47     48         }
    48     49       }
    49     50     }
    50     51   
    51     52     return $result
................................................................................
    53     54   
    54     55   proc getSha1Sum { fileName } {
    55     56     variable fossil
    56     57   
    57     58     set hash [string range [exec -success Success -nocarriagereturns \
    58     59         -trimall -- $fossil sha1sum [appendArgs \" $fileName \"]] 0 39]
    59     60   
    60         -  if {[regexp -- {[0-9a-f]{40}} $hash]} then {
           61  +  if {[regexp -- {[0-9a-f]{40}} $hash] || \
           62  +      [regexp -- {[0-9a-f]{56}} $hash]} then {
    61     63       return $hash
    62     64     }
    63     65   
    64     66     return ""
    65     67   }
    66     68   
    67     69   set argc [llength $argv]

Changes to Tests/basic.eagle.

   153    153     set result
   154    154   } -cleanup {
   155    155     cleanupDb $fileName
   156    156   
   157    157     unset -nocomplain name rows result db fileName
   158    158   } -constraints \
   159    159   {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \
   160         --match regexp -result {^\{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40}\}\
          160  +-match regexp -result {^\{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,56}\}\
   161    161   \{1 \{\{x 1\} \{y foo\} \{z 1234\}\}\} \{count 1\} \{names \{x y z\}\}$}}
   162    162   
   163    163   ###############################################################################
   164    164   
   165    165   runTest {test data-1.5 {GetSchema with ReservedWords} -setup {
   166    166     setupDb [set fileName data-1.5.db]
   167    167   } -body {
................................................................................
  3251   3251   
  3252   3252     cleanupDb $fileName
  3253   3253   
  3254   3254     unset -nocomplain db fileName
  3255   3255   } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
  3256   3256   defineConstant.System.Data.SQLite.INTEROP_FTS5_EXTENSION\
  3257   3257   System.Data.SQLite SQLiteInterop} -match regexp -result \
  3258         -{^\{fts5: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40}\} \{\} \{\} \{\}\
         3258  +{^\{fts5: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,56}\} \{\} \{\} \{\}\
  3259   3259   \{\} \{\} \{rowid 3 x horse rowid 4 x house\}$}}
  3260   3260   
  3261   3261   ###############################################################################
  3262   3262   
  3263   3263   runTest {test data-1.72 {unbind function from a connection} -setup {
  3264   3264     set fileName data-1.72.db
  3265   3265   } -body {

Changes to Tests/version.eagle.

   195    195   -result {^\d+\.\d+\.\d+(?:\.\d+)?$}}
   196    196   
   197    197   ###############################################################################
   198    198   
   199    199   runTest {test version-1.16 {SQLiteSourceId} -body {
   200    200     object invoke System.Data.SQLite.SQLiteConnection SQLiteSourceId
   201    201   } -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \
   202         --result {^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40}$}}
          202  +-result {^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,56}$}}
   203    203   
   204    204   ###############################################################################
   205    205   
   206    206   runTest {test version-1.17 {InteropVersion} -body {
   207    207     object invoke System.Data.SQLite.SQLiteConnection InteropVersion
   208    208   } -constraints {eagle command.object SQLiteInterop System.Data.SQLite} -result \
   209    209   $version(full)}
   210    210   
   211    211   ###############################################################################
   212    212   
   213    213   runTest {test version-1.18 {InteropSourceId} -body {
   214    214     object invoke System.Data.SQLite.SQLiteConnection InteropSourceId
   215    215   } -constraints {eagle command.object SQLiteInterop System.Data.SQLite} -match \
   216         -regexp -result {^[0-9a-f]{40} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$}}
          216  +regexp -result {^[0-9a-f]{40,56} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$}}
   217    217   
   218    218   ###############################################################################
   219    219   
   220    220   runTest {test version-1.19 {ProviderVersion} -body {
   221    221     object invoke System.Data.SQLite.SQLiteConnection ProviderVersion
   222    222   } -constraints {eagle command.object System.Data.SQLite} -result $version(full)}
   223    223   
................................................................................
   226    226   runTest {test version-1.20 {ProviderSourceId} -body {
   227    227     #
   228    228     # NOTE: The ProviderSourceId property value may be null, which
   229    229     #       would result in an empty string being returned here.
   230    230     #
   231    231     object invoke System.Data.SQLite.SQLiteConnection ProviderSourceId
   232    232   } -constraints {eagle command.object System.Data.SQLite} -match regexp -result \
   233         -{^(?:|[0-9a-f]{40} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC)$}}
          233  +{^(?:|[0-9a-f]{40,56} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC)$}}
   234    234   
   235    235   ###############################################################################
   236    236   
   237    237   unset -nocomplain patterns
   238    238   
   239    239   ###############################################################################
   240    240   # readme.htm