public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
From: Achim Gratz <Stromeko@nexgo.de>
To: cygwin-apps@cygwin.com
Subject: Re: setup
Date: Mon, 03 Aug 2015 20:02:00 -0000	[thread overview]
Message-ID: <87mvy8f8dz.fsf@Rainer.invalid> (raw)
In-Reply-To: <87r3nkfaxn.fsf@Rainer.invalid> (Achim Gratz's message of "Mon,	03 Aug 2015 21:07:16 +0200")

[-- Attachment #1: Type: text/plain, Size: 54 bytes --]


Here are the four patches to make setup work again.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Fix-MD5sum.str-formatting-bug.patch --]
[-- Type: text/x-patch, Size: 1314 bytes --]

From c7ad9a642a51753344a841c1718efd963af82505 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@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  <Stromeko@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_hoke@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-Fix-bug-in-nibbled1-and-use-character-types-througho.patch --]
[-- Type: text/x-patch, Size: 2472 bytes --]

From 7faf6f57472ee0247c757f12aff56faf2c2c4919 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@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  <Stromeko@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  <Stromeko@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #4: 0003-If-MD5-checksum-is-missing-then-SHA512-must-always-b.patch --]
[-- Type: text/x-patch, Size: 1621 bytes --]

From ffbee617a0943ef08d250b3d65a1a46a9b7fd9e1 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@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  <Stromeko@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  <Stromeko@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #5: 0004-Simplify-parser-both-SHA512-checksum-types-can-parse.patch --]
[-- Type: text/x-patch, Size: 3872 bytes --]

From 4d0695ecf313e9eede3f6693ea9426e0ce674517 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@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 <Stromeko@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  <Stromeko@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


[-- Attachment #6: Type: text/plain, Size: 197 bytes --]



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

  reply	other threads:[~2015-08-03 20:02 UTC|newest]

Thread overview: 125+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-28 19:19 setup Achim Gratz
2015-07-29 12:51 ` setup Corinna Vinschen
2015-08-01 15:52   ` setup Achim Gratz
2015-08-03 18:03     ` setup Achim Gratz
2015-08-03 19:07       ` setup Achim Gratz
2015-08-03 20:02         ` Achim Gratz [this message]
2015-08-03 20:29           ` setup Corinna Vinschen
2015-08-03 20:31             ` setup Achim Gratz
2015-08-03 20:40               ` setup Corinna Vinschen
2015-08-03 20:54                 ` setup Achim Gratz
2015-08-03 21:20             ` setup Achim Gratz
2015-08-04 18:35               ` setup Achim Gratz
2015-08-05  8:08                 ` setup Corinna Vinschen
2015-08-05 15:42                   ` setup Achim Gratz
2015-08-06 10:03                     ` setup Corinna Vinschen
2015-08-06 15:58                       ` setup Achim Gratz
2015-08-07 19:47                         ` setup Corinna Vinschen
2015-08-07 21:05                           ` setup Warren Young
2015-08-10  8:44                             ` setup Corinna Vinschen
2015-08-10 15:02                               ` setup Warren Young
2015-08-11  7:48                                 ` setup Corinna Vinschen
2015-08-11 19:53                                   ` setup Warren Young
2015-08-08  5:22                           ` setup Achim Gratz
2015-08-10  9:18                             ` setup Corinna Vinschen
2015-08-10 16:33                               ` setup Achim Gratz
2015-08-10 14:44                             ` setup Warren Young
2015-08-10 16:40                               ` setup Achim Gratz
2015-08-10 16:45                                 ` setup Warren Young
2015-08-10 17:00                                   ` setup Achim Gratz
2015-08-10 17:09                                     ` setup Warren Young
2015-08-10 18:03                                       ` setup Achim Gratz
2015-08-10 18:41                                         ` setup Warren Young
  -- strict thread matches above, loose matches on Subject: below --
2015-05-29 19:37 setup Achim Gratz
2015-05-31 10:24 ` setup Corinna Vinschen
2015-06-01 18:11   ` setup Achim Gratz
2015-06-01 18:34     ` setup Corinna Vinschen
2015-06-01 19:49       ` setup Achim Gratz
2015-06-01 21:06         ` setup Corinna Vinschen
2015-06-02  5:17           ` setup Achim Gratz
2015-06-02  8:29             ` setup Corinna Vinschen
2015-06-02 16:24               ` setup Achim Gratz
2015-06-03  8:19                 ` setup Corinna Vinschen
2015-06-03  8:31                   ` setup Marco Atzeri
2015-06-03 11:07                     ` setup Corinna Vinschen
2015-06-03 12:45                       ` setup Eric Blake
2015-06-03 16:51                   ` setup Achim Gratz
2015-06-03 17:04                   ` setup Yaakov Selkowitz
2015-06-03 17:11                     ` setup Achim Gratz
2015-06-08 12:56                       ` setup Corinna Vinschen
2015-06-08 13:49                         ` setup Corinna Vinschen
2015-06-08 18:34                           ` setup Yaakov Selkowitz
2015-06-08 18:47                             ` setup Corinna Vinschen
2015-06-08 19:05                               ` setup Yaakov Selkowitz
2015-06-08 19:35                                 ` setup Corinna Vinschen
2015-06-08 18:52                         ` setup Achim Gratz
2015-06-06 20:58 ` setup Achim Gratz
2015-06-07 20:21   ` setup Achim Gratz
2015-06-08 13:28     ` setup Corinna Vinschen
2015-06-08 18:07       ` setup Achim Gratz
2015-06-08 19:31         ` setup Corinna Vinschen
2015-06-08 20:54           ` setup Achim Gratz
2015-06-09  9:56             ` setup Corinna Vinschen
2015-06-09 16:54               ` setup Achim Gratz
2015-06-10  8:05                 ` setup Corinna Vinschen
2015-06-10 17:47                   ` setup Achim Gratz
2015-06-10 18:54                     ` setup Corinna Vinschen
2015-06-10 20:50                       ` setup Achim Gratz
2015-06-11 10:06                         ` setup Corinna Vinschen
2015-06-11 10:11                           ` setup Corinna Vinschen
2015-06-11 18:10                           ` setup Achim Gratz
2015-06-11 21:03                         ` setup Achim Gratz
2015-06-12 10:29                           ` setup Corinna Vinschen
2015-06-12 17:05                             ` setup Achim Gratz
2015-06-12 17:37                               ` setup Corinna Vinschen
2015-06-24 20:00                                 ` setup Achim Gratz
2015-06-25  8:59                                   ` setup Corinna Vinschen
2015-06-25 16:40                                     ` setup Achim Gratz
2015-06-25 20:16                                       ` setup Achim Gratz
2015-06-26  8:34                                         ` setup Corinna Vinschen
2015-06-26 18:07                                           ` setup Achim Gratz
2015-06-26 19:03                                             ` setup Corinna Vinschen
2015-06-28 13:40                               ` setup Achim Gratz
2015-06-29 13:41                                 ` setup Corinna Vinschen
2015-06-30  4:59                                   ` setup Achim Gratz
2015-06-30 16:40                                     ` setup Corinna Vinschen
2015-06-30 17:14                                       ` setup Achim Gratz
2015-06-30 18:42                                         ` setup Corinna Vinschen
2015-07-01 20:37                                       ` setup Achim Gratz
2015-07-02  9:10                                         ` setup Corinna Vinschen
2015-07-02 21:03                                           ` setup Achim Gratz
2015-07-03 10:14                                             ` setup Corinna Vinschen
2015-07-11 21:31                                           ` setup Achim Gratz
2015-07-13  9:44                                             ` setup Corinna Vinschen
2015-07-14 19:57                                               ` setup Achim Gratz
2002-03-04 19:28 setup Robert Collins
2002-03-04 23:38 ` setup Michael A Chase
2002-03-05  8:31 ` setup Brian Keener
2002-02-20 23:10 Setup Robert Collins
2002-02-18  6:12 Setup Robert Collins
2002-02-18 13:06 ` Setup Brian Keener
2002-02-18 17:26   ` Setup Robert Collins
2002-02-18 20:05     ` Setup Christopher Faylor
2002-02-18 20:19       ` Setup Robert Collins
2002-02-18 20:31         ` Setup Brian Keener
2002-02-18 20:34           ` Setup Robert Collins
2002-02-18 20:44             ` Setup Brian Keener
2002-02-18 20:50               ` Setup Robert Collins
2002-02-19  8:53                 ` Setup Brian Keener
2002-02-24  3:03                   ` Setup Robert Collins
2002-02-18 20:46         ` Setup Christopher Faylor
2002-02-18 20:56           ` Setup Christopher Faylor
2002-02-20 22:45           ` Setup Gary R. Van Sickle
2002-02-20 23:00             ` Setup Christopher Faylor
2002-02-24  3:05           ` Setup Robert Collins
2002-02-24  9:07             ` Setup Christopher Faylor
2002-02-18 20:18     ` Setup Brian Keener
2002-02-18 20:30       ` Setup Robert Collins
2002-02-18 18:48   ` Setup Robert Collins
2002-02-18 19:50     ` Setup Robert Collins
2002-02-22  5:38       ` Setup Brian Keener
2002-02-22 14:46         ` Setup Robert Collins
2002-02-22 19:15           ` Setup Brian Keener
2002-02-22 23:04             ` Setup Christopher Faylor
2002-02-24  2:38             ` Setup Robert Collins
2002-02-27 10:20               ` Setup Brian Keener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mvy8f8dz.fsf@Rainer.invalid \
    --to=stromeko@nexgo.de \
    --cc=cygwin-apps@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).