System.Data.SQLite
Check-in [8d36bd8426]
Not logged in

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

Overview
Comment:Update the release archive verification tool to deal with SHA3 hashes.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8d36bd8426e9ff301fff8f2bc8f13e45ccf64a9f
User & Date: mistachkin 2017-03-14 21:07:43
Context
2017-04-03
23:39
Update SQLite core library to the 3.18.0 release. check-in: e5b99f9b24 user: mistachkin tags: trunk
2017-03-14
21:07
Update the release archive verification tool to deal with SHA3 hashes. check-in: 8d36bd8426 user: mistachkin tags: trunk
2017-03-13
21:22
For the design-time components installer tool, make sure that verbose mode is honored for mock registry keys even in the event that a parameter has an invalid value. check-in: d1111b2d68 user: mistachkin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to Setup/verify.eagle.

    18     18   
    19     19     #
    20     20     # NOTE: Indicate to the caller, if any, that we have failed.
    21     21     #
    22     22     exit 1
    23     23   }
    24     24   
    25         -proc getSha1Hashes { varName } {
           25  +proc getFileHashes { varName } {
    26     26     variable fossil
    27     27   
    28     28     upvar 1 $varName hashes
    29     29   
    30     30     set data [exec -success Success -nocarriagereturns -- \
    31     31         $fossil artifact current]; # or "release"
    32     32   
................................................................................
    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,64}} $hash]} then {
    45     45             set hashes($fileName) $hash; incr result
    46     46           }
    47     47         }
    48     48       }
    49     49     }
    50     50   
    51     51     return $result
................................................................................
    56     56   
    57     57     set hash [string range [exec -success Success -nocarriagereturns \
    58     58         -trimall -- $fossil sha1sum [appendArgs \" $fileName \"]] 0 39]
    59     59   
    60     60     if {[regexp -- {[0-9a-f]{40}} $hash]} then {
    61     61       return $hash
    62     62     }
           63  +
           64  +  return ""
           65  +}
           66  +
           67  +proc getSha3Sum { fileName } {
           68  +  variable fossil
           69  +
           70  +  set hash [string range [exec -success Success -nocarriagereturns \
           71  +      -trimall -- $fossil sha3sum [appendArgs \" $fileName \"]] 0 63]
           72  +
           73  +  if {[regexp -- {[0-9a-f]{64}} $hash]} then {
           74  +    return $hash
           75  +  }
    63     76   
    64     77     return ""
    65     78   }
    66     79   
    67     80   set argc [llength $argv]
    68     81   
    69     82   if {$argc >= 2 && $argc <= 3} then {
................................................................................
   162    175     }
   163    176   
   164    177     if {$withHashes} then {
   165    178       if {![file exists $fossil]} then {
   166    179         usage [appendArgs "tool \"" $fossil "\" is missing"]
   167    180       }
   168    181   
   169         -    if {[getSha1Hashes hashes] == 0} then {
          182  +    if {[getFileHashes hashes] == 0} then {
   170    183         usage "no repository hashes are available"
   171    184       }
   172    185     }
   173    186   
   174    187     set hashPrefix [expr {$failHashes ? "ERROR" : "WARNING"}]
   175    188     set archiveFileNames [list]
   176    189   
................................................................................
   305    318                 "\" missing file \"" $manifestFileName \
   306    319                 "\" from manifest \"" $manifest "\"."]
   307    320   
   308    321             set exitCode 1
   309    322           }
   310    323   
   311    324           #
   312         -        # NOTE: Skip checking SHA1 hashes if it was not requested on the
          325  +        # NOTE: Skip checking hashes if that was not requested on the
   313    326           #       command line.
   314    327           #
   315    328           if {!$withHashes} then {
   316    329             continue
   317    330           }
   318    331   
   319    332           #
   320         -        # HACK: For now, only verify SHA1 hashes for those files actually
          333  +        # HACK: For now, only verify hashes for those files actually
   321    334           #       present in the repository.
   322    335           #
   323    336           if {![string match -nocase -- *Source* $archiveFileName] && \
   324    337               ![info exists hashes($manifestFileName)]} then {
   325    338             continue
   326    339           }
   327    340   
................................................................................
   345    358           }
   346    359   
   347    360           try {
   348    361             if {[info exists hashes($manifestFileName)]} then {
   349    362               if {[catch {
   350    363                 eval [string map $extractCommandMap $extractCommand]
   351    364               } result] == 0} then {
   352         -              set hash [getSha1Sum $extractFileName]
          365  +              if {[string length $hashes($manifestFileName)] == 64} then {
          366  +                set hash [getSha3Sum $extractFileName]
          367  +              } else {
          368  +                set hash [getSha1Sum $extractFileName]
          369  +              }
   353    370   
   354    371                 if {[string length $hash] > 0} then {
   355    372                   if {$hash ne $hashes($manifestFileName)} then {
   356    373                     puts stdout [appendArgs \
   357    374                         $hashPrefix ": Archive \"" $archiveFileName \
   358    375                         "\" file \"" $manifestFileName \
   359    376                         "\" repository hash mismatch, have \"" \