OpenSSL::Ordinals::set_version() should only be given the short version
authorRichard Levitte <levitte@openssl.org>
Wed, 8 Sep 2021 07:40:37 +0000 (09:40 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 9 Sep 2021 10:07:33 +0000 (12:07 +0200)
This function tried to shave off the pre-release and build metadata
text from the the version number it gets, but didn't do that quite
right.  Since this isn't even a documented behaviour, the easier, and
arguably more correct path is for that function not to try to shave
off anything, and for the callers to feed it the short version number,
"{MAJOR}.{MINOR}.{PATCH}", nothing more.

The build file templates are adjusted accordingly.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/16556)

Configurations/descrip.mms.tmpl
Configurations/unix-Makefile.tmpl
Configurations/windows-makefile.tmpl
util/perl/OpenSSL/Ordinals.pm

index 3db0fc72865a486541119594a8e0e7cf9f4c4336..42dea4752a23966d5fa51d4011155347e02b4baf 100644 (file)
@@ -267,6 +267,7 @@ VERBOSE=$(V)
 VERBOSE_FAILURE=$(VF)
 
 VERSION={- "$config{full_version}" -}
+VERSION_NUMBER={- "$config{version}" -}
 MAJOR={- $config{major} -}
 MINOR={- $config{minor} -}
 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
@@ -904,7 +905,7 @@ EOF
           #
           my $target = platform->def($args{src});
           my $mkdef = sourcefile('util', 'mkdef.pl');
-          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
+          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
           my $ord_name =
               $args{generator}->[1] || basename($args{product}, '.EXE');
           my $case_insensitive =
index f88a70f4828ec7673c3e0daf78e51c5ff1a3cc9a..0cab39267cd6bc578dc8900d400c9a8030a77dbf 100644 (file)
@@ -67,6 +67,7 @@ BLDDIR={- $config{builddir} -}
 FIPSKEY={- $config{FIPSKEY} -}
 
 VERSION={- "$config{full_version}" -}
+VERSION_NUMBER={- "$config{version}" -}
 MAJOR={- $config{major} -}
 MINOR={- $config{minor} -}
 SHLIB_VERSION_NUMBER={- $config{shlib_version} -}
@@ -1305,23 +1306,23 @@ SSLHEADERS={- join(" \\\n" . ' ' x 11,
                    fill_lines(" ", $COLUMNS - 11, sort keys %sslheaders)) -}
 
 renumber: build_generated
-       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
+       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
                 --ordinals $(SRCDIR)/util/libcrypto.num \
                 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
                 --renumber \
                 $(CRYPTOHEADERS)
-       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
+       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
                 --ordinals $(SRCDIR)/util/libssl.num \
                 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
                 --renumber \
                 $(SSLHEADERS)
 
 ordinals: build_generated
-       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
+       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
                 --ordinals $(SRCDIR)/util/libcrypto.num \
                 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
                 $(CRYPTOHEADERS)
-       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION) --no-warnings \
+       $(PERL) $(SRCDIR)/util/mknum.pl --version $(VERSION_NUMBER) --no-warnings \
                 --ordinals $(SRCDIR)/util/libssl.num \
                 --symhacks $(SRCDIR)/include/openssl/symhacks.h \
                 $(SSLHEADERS)
@@ -1529,7 +1530,7 @@ EOF
           #
           my $target = platform->def($args{src});
           (my $mkdef_os = $target{shared_target}) =~ s|-shared$||;
-          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
+          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
           my $ord_name = $args{generator}->[1] || $args{product};
           return <<"EOF";
 $target: $gen0 $deps \$(SRCDIR)/util/mkdef.pl
index 26357c75bc347523f2b57b8c1254d65869341c8d..d6dc008ba735ab409928650cb7a425795a99f966 100644 (file)
@@ -41,6 +41,7 @@ BLDDIR={- $config{builddir} -}
 FIPSKEY={- $config{FIPSKEY} -}
 
 VERSION={- "$config{full_version}" -}
+VERSION_NUMBER={- "$config{version}" -}
 MAJOR={- $config{major} -}
 MINOR={- $config{minor} -}
 
@@ -727,7 +728,7 @@ EOF
           my $mkdef = abs2rel(rel2abs(catfile($config{sourcedir},
                                               "util", "mkdef.pl")),
                               rel2abs($config{builddir}));
-          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION)' : '';
+          my $ord_ver = $args{intent} eq 'lib' ? ' --version $(VERSION_NUMBER)' : '';
           my $ord_name =
               $args{generator}->[1] || platform->dsoname($args{product});
           return <<"EOF";
index 7e4c008dc286ebbb57ce2d5f6e8d8ee09feb95dd..f6c63d14c471fa6f7b763cf303174ab641e178af 100644 (file)
@@ -623,8 +623,6 @@ sub set_version {
     my $version = shift // '*';
     my $baseversion = shift // '*';
 
-    $version =~ s|-.*||g;
-
     if ($baseversion eq '*') {
         $baseversion = $version;
         if ($baseversion ne '*') {