From 220350f337dc79d97dbfbd6b57357d90f5486702 Mon Sep 17 00:00:00 2001 From: Bob Beck Date: Thu, 21 Aug 2025 17:15:09 -0600 Subject: [PATCH] Fix apps/progs.pl to be slightly less fragile MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In particular fix the regex magic to be tolerant of different ways of formatting a main program. My past life had forgotten this magic 14 years ago when we converted it to just a table of commands in the forks. https://www.youtube.com/watch?v=mWbbjvYmN8A Reviewed-by: Saša Nedvědický Reviewed-by: Nikola Pajkovsky Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/29241) --- apps/progs.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/progs.pl b/apps/progs.pl index e6dbcd9c793..7abc483a9b9 100644 --- a/apps/progs.pl +++ b/apps/progs.pl @@ -19,7 +19,10 @@ die "Unrecognised option, must be -C or -H\n" unless ($opt eq '-H' || $opt eq '-C'); my %commands = (); -my $cmdre = qr/^\s*int\s+([a-z_][a-z0-9_]*)_main\(\s*int\s+argc\s*,/; +# I think it is best reconsidered in favour of just a table +# of commands instead of this fragile regex. There really are not that +# many commands. +my $cmdre = qr/^\s*(int\s+|)\s*([a-z_][a-z0-9_]*)_main\s*\(\s*int\s+argc\s*,/; my $apps_openssl = shift @ARGV; my $YEAR = [gmtime($ENV{SOURCE_DATE_EPOCH} || time())]->[5] + 1900; @@ -36,7 +39,7 @@ foreach my $filename (@openssl_source) { open F, $filename or die "Couldn't open $filename: $!\n"; foreach ( grep /$cmdre/, ) { my @foo = /$cmdre/; - $commands{$1} = 1; + $commands{$2} = 1; } close F; } -- 2.47.3