Here are the four patches to make setup work again.
>From c7ad9a642a51753344a841c1718efd963af82505 Mon Sep 17 00:00:00 2001 From: Achim Gratz <strom...@stromeko.de> Date: Mon, 3 Aug 2015 20:15:51 +0200 Subject: [PATCH 1/4] Fix MD5sum.str () formatting bug
* csu_util/MD5Sum.cc (str): The stream modifiers are not sticky and must be applied for each conversion. --- ChangeLog | 5 +++++ csu_util/MD5Sum.cc | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d14458..f8cd2b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2015-08-03 Achim Gratz <strom...@nexgo.de> + + * csu_util/MD5Sum.cc (str): The stream modifiers are not sticky + and must be applied for each conversion. + 2015-08-01 David Hoke <d_h...@hotmail.com> * download.cc (IncludeSource): New command line switch diff --git a/csu_util/MD5Sum.cc b/csu_util/MD5Sum.cc index 1d9c362..596089d 100644 --- a/csu_util/MD5Sum.cc +++ b/csu_util/MD5Sum.cc @@ -85,9 +85,9 @@ MD5Sum::str() const { std::ostringstream hexdigest; - hexdigest << std::hex << std::setfill('0') << std::setw(2); for (int i=0; i<16; ++i ) - hexdigest << static_cast<unsigned int>(digest[i]); + hexdigest << std::hex << std::setfill('0') << std::setw(2) + << static_cast<unsigned int>(digest[i]); return hexdigest.str(); } -- 2.4.6
>From 7faf6f57472ee0247c757f12aff56faf2c2c4919 Mon Sep 17 00:00:00 2001 From: Achim Gratz <strom...@stromeko.de> Date: Mon, 3 Aug 2015 21:04:10 +0200 Subject: [PATCH 2/4] Fix bug in nibbled1 and use character types throughout * ini.h (nibbled1): Fix a thinko in this macro that made the result always zero. (hexnibble, nibbled1, b64url, b64d1, b64d2, b64d3): Make all calculation constants dealing with characters character literals. Remove trailing semicolons. --- ChangeLog | 7 +++++++ ini.h | 20 ++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index f8cd2b4..ef3a733 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2015-08-03 Achim Gratz <strom...@nexgo.de> + * ini.h (nibbled1): Fix a thinko in this macro that made the result always zero. + (hexnibble, nibbled1, b64url, b64d1, b64d2, b64d3): Make all + calculation constants dealing with characters character literals. + Remove trailing semicolons. + +2015-08-03 Achim Gratz <strom...@nexgo.de> + * csu_util/MD5Sum.cc (str): The stream modifiers are not sticky and must be applied for each conversion. diff --git a/ini.h b/ini.h index 164e3d2..7f6db22 100644 --- a/ini.h +++ b/ini.h @@ -59,16 +59,16 @@ extern int yyerror_count; /* number of parse errors */ /* The following definitions are used in the parser implementation */ -#define hexnibble(val) (255 & (val > '9') ? val - 'a' + 10 : val - '0'); -#define nibbled1(v1,v2) (255 & ((v1 << 4) & v2)); +#define hexnibble(val) ('\xff' & (val > '9') ? val - 'a' + 10 : val - '0') +#define nibbled1(v1,v2) ('\xff' & ((v1 << 4) | v2)) #define b64url(val) \ - (63 & (( val == '_') ? 63 \ - : (val == '-') ? 62 \ - : (val >= 'a') ? val - 'a' + 26 \ - : (val >= 'A') ? val - 'A' + 0 \ - : val - '0' + 52)) -#define b64d1(v1,v2,v3,v4) (255 & ((v1 << 2) | (v2 >> 4))); -#define b64d2(v1,v2,v3,v4) (255 & ((v2 << 4) | (v3 >> 2))); -#define b64d3(v1,v2,v3,v4) (255 & ((v3 << 6) | v4)); + ('\x3f' & (( val == '_') ? '\x3f' \ + : (val == '-') ? '\x3e' \ + : (val >= 'a') ? val - 'a' + '\x1a' \ + : (val >= 'A') ? val - 'A' + '\x00' \ + : val - '0' + '\x34')) +#define b64d1(v1,v2,v3,v4) ('\xff' & ((v1 << 2) | (v2 >> 4))) +#define b64d2(v1,v2,v3,v4) ('\xff' & ((v2 << 4) | (v3 >> 2))) +#define b64d3(v1,v2,v3,v4) ('\xff' & ((v3 << 6) | v4)) #endif /* SETUP_INI_H */ -- 2.4.6
>From ffbee617a0943ef08d250b3d65a1a46a9b7fd9e1 Mon Sep 17 00:00:00 2001 From: Achim Gratz <strom...@stromeko.de> Date: Mon, 3 Aug 2015 21:19:53 +0200 Subject: [PATCH 3/4] If MD5 checksum is missing then SHA512 must always be checked * install.cc (chksum_one): If MD5 checksum is not available, then SHA512 must always be checked even if just against the zeroed digest as initialized. Otherwise a package with no checksum would be treated as valid. --- ChangeLog | 7 +++++++ install.cc | 6 +++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ef3a733..4d19736 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2015-08-03 Achim Gratz <strom...@nexgo.de> + * install.cc (chksum_one): If MD5 checksum is not available, then + SHA512 must always be checked even if just against the zeroed + digest as initialized. Otherwise a package with no checksum would + be treated as valid. + +2015-08-03 Achim Gratz <strom...@nexgo.de> + * ini.h (nibbled1): Fix a thinko in this macro that made the result always zero. (hexnibble, nibbled1, b64url, b64d1, b64d2, b64d3): Make all calculation constants dealing with characters character literals. diff --git a/install.cc b/install.cc index 4274715..1e69564 100644 --- a/install.cc +++ b/install.cc @@ -1044,8 +1044,8 @@ chksum_one (const packagesource& pkgsource) { if (!pkgsource.Cached ()) return; - if (pkgsource.sha512sum[0]) - sha512_one (pkgsource); - else if (pkgsource.md5.isSet()) + if (pkgsource.md5.isSet()) md5_one (pkgsource); + else + sha512_one (pkgsource); } -- 2.4.6
>From 4d0695ecf313e9eede3f6693ea9426e0ce674517 Mon Sep 17 00:00:00 2001 From: Achim Gratz <strom...@stromeko.de> Date: Mon, 3 Aug 2015 21:23:37 +0200 Subject: [PATCH 4/4] Simplify parser, both SHA512 checksum types can parse to the same token * inilex.ll: Introduce HEX and B64 definitions, use them in the rules section. Parse both SHA512 and SHA512-Base64URL checksums to the SHA512 token. * iniparse.yy (packagedata): Remove all occurences of the SHA512B64URL token. --- ChangeLog | 8 ++++++++ inilex.ll | 10 ++++++---- iniparse.yy | 7 ++----- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4d19736..cf5cbda 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2015-08-03 Achim Gratz <ASSI <strom...@nexgo.de>> + + * inilex.ll: Introduce HEX and B64 definitions, use them in the + rules section. Parse both SHA512 and SHA512-Base64URL checksums + to the SHA512 token. + * iniparse.yy (packagedata): Remove all occurences of the + SHA512B64URL token. + 2015-08-03 Achim Gratz <strom...@nexgo.de> * install.cc (chksum_one): If MD5 checksum is not available, then diff --git a/inilex.ll b/inilex.ll index 86100ae..67764f0 100644 --- a/inilex.ll +++ b/inilex.ll @@ -46,10 +46,12 @@ static void ignore_line (void); %x eolstate STR [!a-zA-Z0-9_./:\+~-]+ +HEX [0-9a-f] +B64 [a-zA-Z0-9_-] %% -[0-9a-f]{32} { +{HEX}{32} { yylval = (char *) new unsigned char[16]; memset (yylval, 0, 16); int i, j; @@ -63,7 +65,7 @@ STR [!a-zA-Z0-9_./:\+~-]+ return MD5; } -[0-9a-f]{128} { +{HEX}{128} { yylval = (char *) new unsigned char[SHA512_DIGEST_LENGTH]; memset (yylval, 0, SHA512_DIGEST_LENGTH); int i, j; @@ -77,7 +79,7 @@ STR [!a-zA-Z0-9_./:\+~-]+ return SHA512; } -[a-zA-Z0-9_-]{86} { +{B64}{86} { /* base64url as defined in RFC4648 */ yylval = (char *) new unsigned char[SHA512_DIGEST_LENGTH]; memset (yylval, 0, SHA512_DIGEST_LENGTH); @@ -98,7 +100,7 @@ STR [!a-zA-Z0-9_./:\+~-]+ v3 = 0; v4 = 0; ((unsigned char *) yylval) [j+0] = b64d1(v1, v2, v3, v4); - return SHA512B64URL; + return SHA512; } \"[^"]*\" { yylval = new char [strlen (yytext+1) + 1]; diff --git a/iniparse.yy b/iniparse.yy index 442135d..5fd6c3f 100644 --- a/iniparse.yy +++ b/iniparse.yy @@ -42,8 +42,8 @@ void add_correct_version(); %token CATEGORY DEPENDS REQUIRES %token APATH PPATH INCLUDE_SETUP EXCLUDE_PACKAGE DOWNLOAD_URL %token T_PREV T_CURR T_TEST -%token SHA512 SHA512B64URL MD5 INSTALLEDSIZE MAINTAINER PRIORITY -%token MD5LINE SHA512LINE +%token INSTALLEDSIZE MAINTAINER PRIORITY +%token MD5 MD5LINE SHA512 SHA512LINE %token DESCTAG DESCRIPTION FILESIZE ARCHITECTURE SOURCEPACKAGE %token RECOMMENDS PREDEPENDS %token SUGGESTS CONFLICTS REPLACES PROVIDES PACKAGENAME STRTOEOL PARAGRAPH @@ -109,7 +109,6 @@ singleitem /* non-empty */ | STANDARDSVERSION STRING NL { /* TODO */ } | MD5LINE MD5 NL { iniBuilder->buildInstallMD5 ((unsigned char *)$2); } | SHA512LINE SHA512 NL { iniBuilder->buildInstallSHA512 ((unsigned char *)$2); } - | SHA512LINE SHA512B64URL NL { iniBuilder->buildInstallSHA512 ((unsigned char *)$2); } | SOURCEPACKAGE source NL | CATEGORY categories NL | INSTALL STRING { iniBuilder->buildPackageInstall ($2); } installmeta NL @@ -149,13 +148,11 @@ installmeta: /* empty */ installchksum: /* empty */ | MD5 { iniBuilder->buildInstallMD5 ((unsigned char *)$1);} | SHA512 { iniBuilder->buildInstallSHA512 ((unsigned char *)$1);} - | SHA512B64URL { iniBuilder->buildInstallSHA512 ((unsigned char *)$1);} ; sourcechksum: /* empty */ | MD5 { iniBuilder->buildSourceMD5 ((unsigned char *)$1); } | SHA512 { iniBuilder->buildSourceSHA512 ((unsigned char *)$1); } - | SHA512B64URL { iniBuilder->buildSourceSHA512 ((unsigned char *)$1); } ; source /* non-empty */ -- 2.4.6
Regards, Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ SD adaptations for KORG EX-800 and Poly-800MkII V0.9: http://Synth.Stromeko.net/Downloads.html#KorgSDada