When producing HTML man-pages, include the original base name
authorRichard Levitte <levitte@openssl.org>
Sat, 22 Jun 2019 07:44:24 +0000 (09:44 +0200)
committerRichard Levitte <levitte@openssl.org>
Sat, 6 Jul 2019 06:31:49 +0000 (08:31 +0200)
For OpenSSL 1.1.0 and on, this isn't relevant any more, since all pod
names should be one of the names in the NAME section.  However, 1.0.2
pages were written differently, and people still refer to the original
base name to look up documentation.

Fixes openssl/openssl#9189

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/web/pull/132)

bin/mk-manpages

index efc95b1e15ff44e0bae8ed0997873d8463ce8e8d..6b57ead51dd30659791688c2d33037b74bfb8304 100755 (executable)
@@ -64,9 +64,17 @@ sub main {
                 print $fh $out or $class->die("Can't print $outinc: $!");
                 close($fh) or $class->die("Can't close $outinc: $!");
 
-                foreach my $htmlname (
-                    map { (my $x = $_) =~ s|/|-|g; $x }
-                        @{$data{names}}) {
+                my @htmlnames =
+                    map { (my $x = $_) =~ s|/|-|g; $x } @{$data{names}};
+                # Older OpenSSL pods have file names that do not correspond
+                # to any of the names in the NAME section.
+                # Strictly speaking, we shouldn't use that name, but HTML
+                # pages with that name have been produced in the past, so
+                # we keep doing so as long as it's relevant.
+                if (! grep { $_ eq $origbase } @htmlnames) {
+                    push @htmlnames, $origbase;
+                }
+                foreach my $htmlname (@htmlnames) {
                     my $htmlfile = File::Spec->catdir( "man$data{sectnum}",
                                                        "$htmlname.html" );
                     my $outhtml = File::Spec->catfile( $wwwdir, $htmlfile );