From 6ca51b155256b2e814b0238119a70545e78106ec Mon Sep 17 00:00:00 2001 From: Andrew Dunstan Date: Fri, 4 Oct 2019 15:34:40 -0400 Subject: [PATCH] Handle spaces in OpenSSL install location for MSVC First, make sure that the .exe name is quoted when trying to get the version number. Also, don't quote the lib name for using in the project files if it's already been quoted. This second change applies to all libraries, not just OpenSSL. This has clearly been broken forever, so backpatch to all live branches. --- src/tools/msvc/Project.pm | 3 ++- src/tools/msvc/Solution.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/tools/msvc/Project.pm b/src/tools/msvc/Project.pm index 4ce09418537..de0a2312e93 100644 --- a/src/tools/msvc/Project.pm +++ b/src/tools/msvc/Project.pm @@ -126,7 +126,8 @@ sub AddLibrary { my ($self, $lib, $dbgsuffix) = @_; - if ($lib =~ m/\s/) + # quote lib name if it has spaces and isn't already quoted + if ($lib =~ m/\s/ && $lib !~ m/^[&]quot;/) { $lib = '"' . $lib . """; } diff --git a/src/tools/msvc/Solution.pm b/src/tools/msvc/Solution.pm index ff7ac43a1ed..4f3b15db6cb 100644 --- a/src/tools/msvc/Solution.pm +++ b/src/tools/msvc/Solution.pm @@ -130,8 +130,9 @@ sub GetOpenSSLVersion # Attempt to get OpenSSL version and location. This assumes that # openssl.exe is in the specified directory. + # Quote the .exe name in case it has spaces my $opensslcmd = - $self->{options}->{openssl} . "\\bin\\openssl.exe version 2>&1"; + qq("$self->{options}->{openssl}\\bin\\openssl.exe" version 2>&1); my $sslout = `$opensslcmd`; $? >> 8 == 0 -- 2.39.5