]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix a bug in tool/mksourceid.c:
authordrh <drh@noemail.net>
Thu, 21 Sep 2017 10:24:10 +0000 (10:24 +0000)
committerdrh <drh@noemail.net>
Thu, 21 Sep 2017 10:24:10 +0000 (10:24 +0000)
The mksourceid.c program was incorrectly including the "# Remove this line"
line of the Fossil-generated "manifest" file in the SHA3 hash.  That means
that all SQLITE_SOURCE_IDs for trunk versions going back to
check-in [30966d56] (2017-08-22) are incorrect.

FossilOrigin-Name: 65765222ef6f4e80c05a24994fcee145f5fbc0ad35c9fab3d75492964b3eb187

manifest
manifest.uuid
tool/mksourceid.c

index 3992ec18ab1d5c45aa2f751719a195322781d83f..3f614bb8075e6b90fddf1f4d7535fc90f4a789f3 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Revert\sone\sperformance\simprovement\schanges\sfrom\scheck-in\s[3b3e32d4cd07]\sas\nit\swas\scausing\sa\sreference\sto\san\suninitialized\svalue.
-D 2017-09-21T01:04:30.271
+C Fix\sa\sbug\sin\stool/mksourceid.c:\s\nThe\smksourceid.c\sprogram\swas\sincorrectly\sincluding\sthe\s"#\sRemove\sthis\sline"\nline\sof\sthe\sFossil-generated\s"manifest"\sfile\sin\sthe\sSHA3\shash.\s\sThat\smeans\nthat\sall\sSQLITE_SOURCE_IDs\sfor\strunk\sversions\sgoing\sback\sto\ncheck-in\s[30966d56]\s(2017-08-22)\sare\sincorrect.
+D 2017-09-21T10:24:10.329
 F Makefile.in 4bc36d913c2e3e2d326d588d72f618ac9788b2fd4b7efda61102611a6495c3ff
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 6033b51b6aea702ea059f6ab2d47b1d3cef648695f787247dd4fb395fe60673f
@@ -1593,7 +1593,7 @@ F tool/mkopcodeh.tcl 4ee2a30ccbd900dc4d5cdb61bdab87cd2166cd2affcc78c9cc0b8d22a65
 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e
 F tool/mkpragmatab.tcl 2144bc8550a6471a029db262a132d2df4b9e0db61b90398bf64f5b7b3f8d92cd
 F tool/mkshellc.tcl 950c36f45941c12140e346a907fb66198bc2770ff7a17c749201e78d34bb3b0b
-F tool/mksourceid.c 30966d568654a4fd962fb324753e49429b7379e1f72d2be489ade963121f5943
+F tool/mksourceid.c d458f9004c837bee87a6382228ac20d3eae3c49ea3b0a5aace936f8b60748d3b
 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97
 F tool/mksqlite3c-noext.tcl fef88397668ae83166735c41af99d79f56afaabb
 F tool/mksqlite3c.tcl b258d679829a9305f5cf107b7d97b9bf23adb3773df42947fed5ef7b180dfbd9
@@ -1655,7 +1655,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P adc12c83dda8ba93ca220bbff649f763058b9440968ae463621f0cb7de8889cf
-R 74e9a42e62567d447ce10652f9c93fed
+P f8b1c64d3eeb8413ca149f34cc00f9154a5446d06ad33bbffa69118e6110f81d
+R 64106870c2d3f0ac5e3f96924365cf0c
 U drh
-Z 07fc711a459108ff2c2431795ab36ea3
+Z 04dce0480829a76620b41bbfd98b4888
index 4aaeed6a9dee222fe85f8ea124b207416c39fd2a..8d5471ba5fe26e82a5624f5bf3edb373ad27a179 100644 (file)
@@ -1 +1 @@
-f8b1c64d3eeb8413ca149f34cc00f9154a5446d06ad33bbffa69118e6110f81d
\ No newline at end of file
+65765222ef6f4e80c05a24994fcee145f5fbc0ad35c9fab3d75492964b3eb187
\ No newline at end of file
index 0e20b3c3d39df931c73211d4e915f46bf7cb7da0..282f5c44140c2d800a5b93be7eb0b59011270791 100644 (file)
@@ -777,9 +777,10 @@ int main(int argc, char **argv){
   FILE *in;
   int allValid = 1;
   int rc;
+  SHA3Context ctx;
   char zDate[50];
   char zHash[100];
-  char zLine[1000];
+  char zLine[20000];
 
   for(i=1; i<argc; i++){
     const char *z = argv[i];
@@ -805,7 +806,11 @@ int main(int argc, char **argv){
     fprintf(stderr, "cannot open \"%s\" for reading\n", zManifest);
     exit(1);
   }
+  SHA3Init(&ctx, 256);
   while( fgets(zLine, sizeof(zLine), in) ){
+    if( strncmp(zLine,"# Remove this line", 18)!=0 ){
+      SHA3Update(&ctx, (unsigned char*)zLine, (unsigned)strlen(zLine));
+    }
     if( strncmp(zLine, "D 20", 4)==0 ){
       memcpy(zDate, &zLine[2], 10);
       zDate[10] = ' ';
@@ -826,8 +831,6 @@ int main(int argc, char **argv){
         allValid = 0;
         if( bVerbose ){
           printf("hash failed: %s\n", zFilename);
-        }else{
-          break;
         }
       }else if( strcmp(zHash, zMHash)!=0 ){
         allValid = 0;
@@ -835,14 +838,12 @@ int main(int argc, char **argv){
           printf("wrong hash: %s\n", zFilename);
           printf("... expected: %s\n", zMHash);
           printf("... got:      %s\n", zHash);
-        }else{
-          break;
         }
       }
     }
   }
   fclose(in);
-  sha3sum_file(zManifest, 256, zHash);
+  DigestToBase16(SHA3Final(&ctx), zHash, 256/8);
   if( !allValid ){
     printf("%s %.60salt1\n", zDate, zHash);
   }else{