From: drh <> Date: Sun, 4 Jun 2023 22:56:31 +0000 (+0000) Subject: Enhancement to tool/src-verify.c to also check the manifest.uuid file. X-Git-Tag: version-3.43.0~226 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10ca116b3e7bb0106ce41f9d21eca376897c2188;p=thirdparty%2Fsqlite.git Enhancement to tool/src-verify.c to also check the manifest.uuid file. FossilOrigin-Name: a39a569482a35610fdaa2fdfc88491d8b456dfedb4786c817e0502eb3e3a5563 --- diff --git a/manifest b/manifest index b67d3f15e5..14b11ba60b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Add\sa\sprototype\simplementation\sfor\sthe\s"verify-source"\sMakefile\starget. -D 2023-06-04T22:41:52.198 +C Enhancement\sto\stool/src-verify.c\sto\salso\scheck\sthe\smanifest.uuid\sfile. +D 2023-06-04T22:56:31.633 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 @@ -2040,7 +2040,7 @@ F tool/sqldiff.c 2a693b4e7c1818c23f871f82f0c3fe67d80b67e3f087893089d33da29c1e387 F tool/sqlite3_analyzer.c.in f88615bf33098945e0a42f17733f472083d150b58bdaaa5555a7129d0a51621c F tool/sqltclsh.c.in 1bcc2e9da58fadf17b0bf6a50e68c1159e602ce057210b655d50bad5aaaef898 F tool/sqltclsh.tcl 862f4cf1418df5e1315b5db3b5ebe88969e2a784525af5fbf9596592f14ed848 -F tool/src-verify.c 9c4b55bdc51c8a490e530b0f0f631a59fee4fdee0278bd9097f948f307ed36af +F tool/src-verify.c e5e9dc2ed69c758d8e0b81f5ec0aaadd9fbd823aa32b250364e093c3d11edef4 F tool/srcck1.c 371de5363b70154012955544f86fdee8f6e5326f F tool/stack_usage.tcl f8e71b92cdb099a147dad572375595eae55eca43 F tool/stripccomments.c 20b8aabc4694d0d4af5566e42da1f1a03aff057689370326e9269a9ddcffdc37 @@ -2073,8 +2073,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P b6c2d3d203100a34335aeba23a8fb82a13297b65eed494d5044ade3bed683bc3 -R 7131dcbde84d84c042e61b5c7bb9292b +P ed876ff6a1a6a2d555f32b96eb78d95eaf8428ee189f968c43f0829a3065bfa7 +R 9b0a2b61006df3d756be5515b62f26fb U drh -Z 4617e8d9f477cb4cf350e326572c6bfc +Z 003c541e1b3df30b4cc522e965c30af6 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index e1d85d7b13..376b2890be 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -ed876ff6a1a6a2d555f32b96eb78d95eaf8428ee189f968c43f0829a3065bfa7 \ No newline at end of file +a39a569482a35610fdaa2fdfc88491d8b456dfedb4786c817e0502eb3e3a5563 \ No newline at end of file diff --git a/tool/src-verify.c b/tool/src-verify.c index f54f85d562..8cf2f8df9b 100644 --- a/tool/src-verify.c +++ b/tool/src-verify.c @@ -2,6 +2,16 @@ ** This utility program reads the "manifest" and "manifest.uuid" files ** of the SQLite source tree and uses the content therein to verify that ** all of the other files in the source tree are correct. +** +** Limitations: +** +** * Does not handle special characters in the filenames. The +** SQLite source tree has no filenames containing special +** characters, so that should not be an issue. +** +** * Filename length is limited to 1000 characters. The SQLite +** source tree has no files more than 100 characters in length +** so that also should not be an issue. */ #include #include @@ -717,8 +727,7 @@ void sha1sum_file(const char *zFilename, char *zCksum){ */ static void errorMsg(int *pnErr, const char *zVers, const char *zFile){ if( *pnErr==0 ){ - printf("Derived from version %s\n", zVers); - printf("Files that are modified or omitted:\n"); + printf("Derived from %.25s with changes to:\n", zVers); } printf(" %s\n", zFile); (*pnErr)++; @@ -797,6 +806,7 @@ int main(int argc, char **argv){ SHA3Update(&ctx3, (unsigned char*)zLine, strlen(zLine)); } DigestToBase16(SHA3Final(&ctx3), zVers, 32); + rewind(in); while( fgets(zLine, sizeof(zLine), in) ){ if( zLine[0]!='F' ) continue; @@ -838,7 +848,20 @@ int main(int argc, char **argv){ } } fclose(in); + in = 0; + memcpy(&zFile[nDir], "manifest.uuid", 14); + if( access(zFile, R_OK)!=0 + || (in = fopen(zFile,"rb"))==0 + || fgets(zLine, sizeof(zLine), in)==0 + || strlen(zLine)!=65 + || zLine[64]!='\n' + || memcmp(zLine, zVers, 64)!=0 + ){ + errorMsg(&nErr, zVers, &zFile[nDir]); + } + if( in ) fclose(in); + if( nErr ) return nErr; - printf("Version %s\n", zVers); + printf("OK %.25s\n", zVers); return 0; }