]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Modify util/mknum.pl to drop new symbols that don't exist any more
authorRichard Levitte <levitte@openssl.org>
Thu, 8 Oct 2020 04:30:35 +0000 (06:30 +0200)
committerRichard Levitte <levitte@openssl.org>
Fri, 9 Oct 2020 08:19:47 +0000 (10:19 +0200)
This makes use of the writer filters in OpenSSL::Ordinals.

Fixes #10395

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13092)

util/mknum.pl

index 4ee87c29a8264c1a4e008ce1427fb241c1e0a163..8f840ffe7f89012c299ac082103f2e8513acb69c 100644 (file)
@@ -118,7 +118,15 @@ if ($checkexist) {
         }
     }
 } else {
-    $ordinals->rewrite();
+    my $dropped = 0;
+    my $unassigned;
+    my $filter = sub {
+        my $item = shift;
+        my $result = $item->number() ne '?' || $item->exists();
+        $dropped++ unless $result;
+        return $result;
+    };
+    $ordinals->rewrite(filter => $filter);
     my %stats = $ordinals->stats();
     print STDERR
         "${ordinals_file}: $stats{modified} old symbols have updated info\n"
@@ -128,9 +136,13 @@ if ($checkexist) {
     } else {
         print STDERR "${ordinals_file}: No new symbols added\n";
     }
-    if ($stats{unassigned}) {
-        my $symbol = $stats{unassigned} == 1 ? "symbol" : "symbols";
-        my $is = $stats{unassigned} == 1 ? "is" : "are";
-        print STDERR "${ordinals_file}: $stats{unassigned} $symbol $is without ordinal number\n";
+    if ($dropped) {
+        print STDERR "${ordinals_file}: Dropped $dropped new symbols\n";
+    }
+    $unassigned = $stats{unassigned} - $dropped;
+    if ($unassigned) {
+        my $symbol = $unassigned == 1 ? "symbol" : "symbols";
+        my $is = $unassigned == 1 ? "is" : "are";
+        print STDERR "${ordinals_file}: $unassigned $symbol $is without ordinal number\n";
     }
 }