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 |
Timelines: | family | ancestors | descendants | both | fossil-2.0 |
Files: | files | file ages | folders |
SHA1: |
5c2462c16b288b44a17d3c40f0b008b5 |
User & Date: | mistachkin 2017-02-27 17:56:25.289 |
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
Changes to Setup/updateFileInfo.tcl.
︙ | ︙ | |||
32 33 34 35 36 37 38 | # decimal. # return [format %.2f [expr {[file size $fileName] / 1048576.0}]] } proc getFileHash { fileName } { # | | | | | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | # decimal. # return [format %.2f [expr {[file size $fileName] / 1048576.0}]] } proc getFileHash { fileName } { # # NOTE: Return the SHA3 hash of the file, making use of Fossil via [exec] to # actually calculate it. # return [string trim [lindex [regexp -inline -nocase -- {[0-9A-F]{56} } \ [exec fossil sha3sum $fileName]] 0]] } # # NOTE: Grab the fully qualified directory name of the directory containing # this script file. # set path [file normalize [file dirname [info script]]] |
︙ | ︙ | |||
81 82 83 84 85 86 87 | [string length $outputDirectory] == 0} then { set outputDirectory [file join $path Output] } # # NOTE: Setup the regular expression patterns with the necessary captures. # These patterns are mostly non-greedy; however, at the end we need to | | | | | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | [string length $outputDirectory] == 0} then { set outputDirectory [file join $path Output] } # # NOTE: Setup the regular expression patterns with the necessary captures. # These patterns are mostly non-greedy; however, at the end we need to # match exactly 56 hexadecimal characters. In theory, in Tcl, this could # have an undefined result due to the mixing of greedy and non-greedy # quantifiers; however, in practice, this seems to work properly. Also, # this pattern assumes a particular structure for the [HTML] file to be # updated. # set pattern1 {<a\ href=".*?/(.*?\.(?:exe|zip|nupkg))">.*?\((\d+?\.\d+?) MiB\).*?sha3:\ ([0-9A-F]{56})} set pattern2 {<a\ href=".*?/package/.*?/\d+\.\d+\.\d+\.\d+">(.*?)</a>.*?\((\d+?\.\d+?)\ MiB\).*?sha3: ([0-9A-F]{56})} set pattern3 {href="/downloads/(.*?)"} set pattern4 {\(sha3: ([0-9A-F]{56})\)} set pattern5 {\((\d+?\.\d+?) MiB\)} # # NOTE: Grab all the data from the file to be updated. # set data [readFile $updateFileName] |
︙ | ︙ | |||
181 182 183 184 185 186 187 | incr start [string length $fileHash] } } } # | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | incr start [string length $fileHash] } } } # # NOTE: Attempt to verify that each file name now has the correct SHA3 hash # associated with it on the page. # foreach {dummy3 fileName} [regexp -all -inline -nocase -- $pattern3 $data] \ {dummy4 fileHash} [regexp -all -inline -nocase -- $pattern4 $data] \ {dummy5 fileSize} [regexp -all -inline -nocase -- $pattern5 $data] { # # NOTE: Get the fully qualified file name based on the configured |
︙ | ︙ | |||
208 209 210 211 212 213 214 | # # NOTE: Make sure the file hash from the [modified] data matches the # calculated hash for the file. If not, fail. # set fullFileHash [getFileHash $fullFileName] if {$fileHash ne $fullFileHash} then { | | | 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | # # NOTE: Make sure the file hash from the [modified] data matches the # calculated hash for the file. If not, fail. # set fullFileHash [getFileHash $fullFileName] if {$fileHash ne $fullFileHash} then { puts stdout "ERROR: SHA3 hash mismatch for\ file \"$fullFileName\", have \"$fileHash\" (from data),\ need \"$fullFileHash\" (calculated)." } set fullFileSize [getFileSize $fullFileName] if {$fileSize ne $fullFileSize} then { |
︙ | ︙ |
Changes to Setup/verify.eagle.
︙ | ︙ | |||
37 38 39 40 41 42 43 | if {[string range $line 0 1] eq "F "} then { set fields [split $line " "] if {[llength $fields] >= 3} then { set fileName [string map [list \\s " "] [lindex $fields 1]] set hash [lindex $fields 2] | | > | > | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | if {[string range $line 0 1] eq "F "} then { set fields [split $line " "] if {[llength $fields] >= 3} then { set fileName [string map [list \\s " "] [lindex $fields 1]] set hash [lindex $fields 2] if {[regexp -- {[0-9a-f]{40}} $hash] || \ [regexp -- {[0-9a-f]{56}} $hash]} then { set hashes($fileName) $hash; incr result } } } } return $result } proc getSha1Sum { fileName } { variable fossil set hash [string range [exec -success Success -nocarriagereturns \ -trimall -- $fossil sha1sum [appendArgs \" $fileName \"]] 0 39] if {[regexp -- {[0-9a-f]{40}} $hash] || \ [regexp -- {[0-9a-f]{56}} $hash]} then { return $hash } return "" } set argc [llength $argv] |
︙ | ︙ |
Changes to Tests/basic.eagle.
︙ | ︙ | |||
153 154 155 156 157 158 159 | set result } -cleanup { cleanupDb $fileName unset -nocomplain name rows result db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \ | | | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | set result } -cleanup { cleanupDb $fileName unset -nocomplain name rows result db fileName } -constraints \ {eagle monoBug28 command.sql compile.DATA SQLite System.Data.SQLite} \ -match regexp -result {^\{\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,56}\}\ \{1 \{\{x 1\} \{y foo\} \{z 1234\}\}\} \{count 1\} \{names \{x y z\}\}$}} ############################################################################### runTest {test data-1.5 {GetSchema with ReservedWords} -setup { setupDb [set fileName data-1.5.db] } -body { |
︙ | ︙ | |||
3251 3252 3253 3254 3255 3256 3257 | cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ defineConstant.System.Data.SQLite.INTEROP_FTS5_EXTENSION\ System.Data.SQLite SQLiteInterop} -match regexp -result \ | | | 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 | cleanupDb $fileName unset -nocomplain db fileName } -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\ defineConstant.System.Data.SQLite.INTEROP_FTS5_EXTENSION\ System.Data.SQLite SQLiteInterop} -match regexp -result \ {^\{fts5: \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,56}\} \{\} \{\} \{\}\ \{\} \{\} \{rowid 3 x horse rowid 4 x house\}$}} ############################################################################### runTest {test data-1.72 {unbind function from a connection} -setup { set fileName data-1.72.db } -body { |
︙ | ︙ |
Changes to Tests/version.eagle.
︙ | ︙ | |||
195 196 197 198 199 200 201 | -result {^\d+\.\d+\.\d+(?:\.\d+)?$}} ############################################################################### runTest {test version-1.16 {SQLiteSourceId} -body { object invoke System.Data.SQLite.SQLiteConnection SQLiteSourceId } -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \ | | | | | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | -result {^\d+\.\d+\.\d+(?:\.\d+)?$}} ############################################################################### runTest {test version-1.16 {SQLiteSourceId} -body { object invoke System.Data.SQLite.SQLiteConnection SQLiteSourceId } -constraints {eagle command.object SQLite System.Data.SQLite} -match regexp \ -result {^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} [0-9a-f]{40,56}$}} ############################################################################### runTest {test version-1.17 {InteropVersion} -body { object invoke System.Data.SQLite.SQLiteConnection InteropVersion } -constraints {eagle command.object SQLiteInterop System.Data.SQLite} -result \ $version(full)} ############################################################################### runTest {test version-1.18 {InteropSourceId} -body { object invoke System.Data.SQLite.SQLiteConnection InteropSourceId } -constraints {eagle command.object SQLiteInterop System.Data.SQLite} -match \ regexp -result {^[0-9a-f]{40,56} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$}} ############################################################################### runTest {test version-1.19 {ProviderVersion} -body { object invoke System.Data.SQLite.SQLiteConnection ProviderVersion } -constraints {eagle command.object System.Data.SQLite} -result $version(full)} ############################################################################### runTest {test version-1.20 {ProviderSourceId} -body { # # NOTE: The ProviderSourceId property value may be null, which # would result in an empty string being returned here. # object invoke System.Data.SQLite.SQLiteConnection ProviderSourceId } -constraints {eagle command.object System.Data.SQLite} -match regexp -result \ {^(?:|[0-9a-f]{40,56} \d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC)$}} ############################################################################### unset -nocomplain patterns ############################################################################### # readme.htm |
︙ | ︙ |