This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: Add guard against Unicode breakage
authorKarl Williamson <khw@cpan.org>
Tue, 1 May 2018 21:47:11 +0000 (15:47 -0600)
committerKarl Williamson <khw@cpan.org>
Mon, 25 Jun 2018 13:33:30 +0000 (07:33 -0600)
This adds a check that a new Unicode version doesn't create a rational
number that is too close to a current rational for our existing
floating point precision.  Should this happen, we can increase the
precision we use.

charclass_invlists.h
lib/unicore/mktables
regcharclass.h
uni_keywords.h

index 259e73f..8b6ac63 100644 (file)
@@ -374323,7 +374323,7 @@ static const U8 WB_table[24][24] = {
  * be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt
  * 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt
  * e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt
- * d86a9893f6c106416be89b5f4668a212364638d9ae58b49ec1e05349f3e91c74 lib/unicore/mktables
+ * f364c5c093e0ea66c2f5059e05855559065dc850e89027730312185ab30169f2 lib/unicore/mktables
  * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
  * 4bb677187a1a64e39d48f2e341b5ecb6c99857e49d7a79cf503bd8a3c709999b regen/charset_translations.pl
  * 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl
index 6d63c98..7c7dd6b 100644 (file)
@@ -12956,6 +12956,14 @@ sub register_fraction($) {
 
     my $float = eval $rational;
     $float = sprintf "%.*e", $E_FLOAT_PRECISION, $float;
+    if (   defined $nv_floating_to_rational{$float}
+        && $nv_floating_to_rational{$float} ne $rational)
+    {
+        die Carp::my_carp_bug("Both '$rational' and"
+                            . " '$nv_floating_to_rational{$float}' evaluate to"
+                            . " the same floating point number."
+                            . "  \$E_FLOAT_PRECISION must be increased");
+    }
     $nv_floating_to_rational{$float} = $rational;
     return;
 }
index 9747ae5..f7c29e8 100644 (file)
  * be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt
  * 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt
  * e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt
- * d86a9893f6c106416be89b5f4668a212364638d9ae58b49ec1e05349f3e91c74 lib/unicore/mktables
+ * f364c5c093e0ea66c2f5059e05855559065dc850e89027730312185ab30169f2 lib/unicore/mktables
  * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
  * 4bb677187a1a64e39d48f2e341b5ecb6c99857e49d7a79cf503bd8a3c709999b regen/charset_translations.pl
  * 9ea6338945a7d70e5ea4b31ac7856c0b521df96be002e94b4b3b7d31debbf3ab regen/regcharclass.pl
index 51676f3..685bddf 100644 (file)
@@ -6834,7 +6834,7 @@ MPH_VALt match_uniprop( const unsigned char * const key, const U16 key_len ) {
  * be0f129691d479aa38646e4ca0ec1ee576ae7f75b0300a5624a7fa862fa8abba lib/unicore/extracted/DLineBreak.txt
  * 92449d354d9f6b6f2f97a292ebb59f6344ffdeb83d120d7d23e569c43ba67cd5 lib/unicore/extracted/DNumType.txt
  * e3a319527153b0c6c0c549b40fc6f3a01a7a0dcd6620784391db25901df3b154 lib/unicore/extracted/DNumValues.txt
- * d86a9893f6c106416be89b5f4668a212364638d9ae58b49ec1e05349f3e91c74 lib/unicore/mktables
+ * f364c5c093e0ea66c2f5059e05855559065dc850e89027730312185ab30169f2 lib/unicore/mktables
  * 21653d2744fdd071f9ef138c805393901bb9547cf3e777ebf50215a191f986ea lib/unicore/version
  * 4bb677187a1a64e39d48f2e341b5ecb6c99857e49d7a79cf503bd8a3c709999b regen/charset_translations.pl
  * 03e51b0f07beebd5da62ab943899aa4934eee1f792fa27c1fb638c33bf4ac6ea regen/mk_PL_charclass.pl