This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
mktables: For 8.3 filesystems, the suffix matters
authorKarl Williamson <khw@cpan.org>
Mon, 27 Jul 2015 04:25:57 +0000 (22:25 -0600)
committerKarl Williamson <khw@cpan.org>
Wed, 29 Jul 2015 04:15:57 +0000 (22:15 -0600)
Two files can have the same file name, but be different if they have
different suffixes.  Until this commit, mktables thought they were the
same, because it ignored the suffix when calculating this.  Some files
are version strings like "3.1" which look like a floating point number.
These are converted to like "3_1" first so that the .1 doesn't look like
a suffix.

charclass_invlists.h
lib/unicore/mktables
regcharclass.h

index fee6e17..a6abb18 100644 (file)
@@ -99521,7 +99521,7 @@ static const UV XPosixXDigit_invlist[] = { /* for EBCDIC POSIX-BC */
  * 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
  * 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
  * a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * 6d9e5e4291b682eae71b0c05ef99728072b5fe4900dab2a53b44664ee3b7b0f7 lib/unicore/mktables
+ * 1d88fcd43ba9c63e371065e1804c8f5bd29656df507c2747139657172aca68a4 lib/unicore/mktables
  * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
  * c6884f4d629f04d1316f3476cb1050b6a1b98ca30c903262955d4eae337c6b1e regen/charset_translations.pl
  * 7b6f61662df48e0cbfb234a926e02e5cb9468af052f7f9feb84285996f30df09 regen/mk_invlists.pl
index 1a7f5f4..57962bb 100644 (file)
@@ -15264,7 +15264,22 @@ sub register_file_for_name($$$) {
         # Remove interior underscores.
         (my $filename = $name) =~ s/ (?<=.) _ (?=.) //xg;
 
-        # Change any non-word character into an underscore, and truncate to 8.
+        # Convert the dot in floating point numbers to an underscore
+        $filename =~ s/\./_/ if $filename =~ / ^ \d+ \. \d+ $ /x;
+
+        my $suffix = "";
+
+        # Extract any suffix, delete any non-word character, and truncate to 3
+        # after the dot
+        if ($filename =~ m/ ( .*? ) ( \. .* ) /x) {
+            $filename = $1;
+            $suffix = $2;
+            $suffix =~ s/\W+//g;
+            substr($suffix, 4) = "" if length($suffix) > 4;
+        }
+
+        # Change any non-word character outside the suffix into an underscore,
+        # and truncate to 8.
         $filename =~ s/\W+/_/g;   # eg., "L&" -> "L_"
         substr($filename, 8) = "" if length($filename) > 8;
 
@@ -15276,7 +15291,7 @@ sub register_file_for_name($$$) {
         #     InGreekE
         #     InGreek2
         my $warned = 0;
-        while (my $num = $base_names{$path}{lc $filename}++) {
+        while (my $num = $base_names{$path}{lc "$filename$suffix"}++) {
             $num++; # so basenames with numbers start with '2', which
                     # just looks more natural.
 
index a25be36..46dcb5b 100644 (file)
  * 1a0687fb9c6c4567e853913549df0944fe40821279a3e9cdaa6ab8679bc286fd lib/unicore/extracted/DLineBreak.txt
  * 40bcfed3ca727c19e1331f6c33806231d5f7eeeabd2e6a9e06a3740c85d0c250 lib/unicore/extracted/DNumType.txt
  * a18d502bad39d527ac5586d7bc93e29f565859e3bcc24ada627eff606d6f5fed lib/unicore/extracted/DNumValues.txt
- * 6d9e5e4291b682eae71b0c05ef99728072b5fe4900dab2a53b44664ee3b7b0f7 lib/unicore/mktables
+ * 1d88fcd43ba9c63e371065e1804c8f5bd29656df507c2747139657172aca68a4 lib/unicore/mktables
  * 462c9aaa608fb2014cd9649af1c5c009485c60b9c8b15b89401fdc10cf6161c6 lib/unicore/version
  * c6884f4d629f04d1316f3476cb1050b6a1b98ca30c903262955d4eae337c6b1e regen/charset_translations.pl
  * d9c04ac46bdd81bb3e26519f2b8eb6242cb12337205add3f7cf092b0c58dccc4 regen/regcharclass.pl