Ensure `$(MAKE)` commands and `CFLAGS` are appropriately quoted in the Makefile.
authorHamilton Chapman <hamchapman@gmail.com>
Wed, 21 Feb 2024 13:47:19 +0000 (13:47 +0000)
committerTomas Mraz <tomas@openssl.org>
Sun, 25 Feb 2024 08:02:25 +0000 (09:02 +0100)
If a user's `make` command came from a path that contained a space then both the
`$(MAKE)` variable (and parts of the generated `CFLAGS`, when building for iOS)
would not be properly quoted and the build would fail.

Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23663)

(cherry picked from commit aba621934696ca52193bd41cd35816649b6b321b)

Configurations/15-ios.conf
Configurations/unix-Makefile.tmpl

index 54d37f63f445d450ae767903da4d102328b0f142..81e3d68bc7f096c931b7b5f1ddc76c046af6d511 100644 (file)
@@ -49,16 +49,16 @@ my %targets = (
 #
     "iphoneos-cross" => {
         inherit_from     => [ "ios-common" ],
-        cflags           => add("-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK) -fno-common"),
+        cflags           => add("-isysroot \"\$(CROSS_TOP)/SDKs/\$(CROSS_SDK)\" -fno-common"),
     },
     "ios-cross" => {
         inherit_from     => [ "ios-xcrun" ],
         CC               => "cc",
-        cflags           => add("-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK)"),
+        cflags           => add("-isysroot \"\$(CROSS_TOP)/SDKs/\$(CROSS_SDK)\""),
     },
     "ios64-cross" => {
         inherit_from     => [ "ios64-xcrun" ],
         CC               => "cc",
-        cflags           => add("-isysroot \$(CROSS_TOP)/SDKs/\$(CROSS_SDK)"),
+        cflags           => add("-isysroot \"\$(CROSS_TOP)/SDKs/\$(CROSS_SDK)\""),
     },
 );
index 3754595d38b50aa7c92589781c9f06604dac4f70..644540397de596792c0df247f95b5aff959e17d5 100644 (file)
@@ -21,7 +21,7 @@
      sub dependmagic {
          my $target = shift;
 
-         return "$target: build_generated\n\t\$(MAKE) depend && \$(MAKE) _$target\n_$target";
+         return "$target: build_generated\n\t\"\$(MAKE)\" depend && \"\$(MAKE)\" _$target\n_$target";
      }
 
      our $COLUMNS = $ENV{COLUMNS};
@@ -527,7 +527,7 @@ all: build_sw build_docs
 
 test: tests
 {- dependmagic('tests'); -}: build_programs_nodep build_modules_nodep link-utils
-       $(MAKE) run_tests
+       "$(MAKE)" run_tests
 run_tests: FORCE
        @ : {- output_off() if $disabled{tests}; "" -}
        ( SRCTOP=$(SRCDIR) \
@@ -542,7 +542,7 @@ run_tests: FORCE
 
 list-tests:
        @ : {- output_off() if $disabled{tests}; "" -}
-       $(MAKE) run_tests TESTS=list
+       "$(MAKE)" run_tests TESTS=list
        @ : {- if ($disabled{tests}) { output_on(); } else { output_off(); } "" -}
        @echo "Tests are not supported with your chosen Configure options"
        @ : {- output_on() if !$disabled{tests}; "" -}
@@ -1193,12 +1193,12 @@ providers/fips.module.sources.new: configdata.pm
          cd sources-tmp \
          && $$srcdir/Configure --banner=Configured enable-fips -O0 \
          && ./configdata.pm --query 'get_sources("providers/fips")' > sources1 \
-         && $(MAKE) -sj 4 build_generated providers/fips.so \
+         && "$(MAKE)" -sj 4 build_generated providers/fips.so \
          && find . -name '*.d' | xargs cat > dep1 \
-          && $(MAKE) distclean \
+          && "$(MAKE)" distclean \
          && $$srcdir/Configure --banner=Configured enable-fips no-asm -O0 \
          && ./configdata.pm --query 'get_sources("providers/fips")' > sources2 \
-         && $(MAKE) -sj 4 build_generated providers/fips.so \
+         && "$(MAKE)" -sj 4 build_generated providers/fips.so \
          && find . -name '*.d' | xargs cat > dep2 \
          && cat sources1 sources2 \
             | grep -v ' : \\$$' | grep -v util/providers.num \
@@ -1332,7 +1332,7 @@ ordinals: build_generated
                 $(SSLHEADERS)
 
 test_ordinals:
-       $(MAKE) run_tests TESTS=test_ordinals
+       "$(MAKE)" run_tests TESTS=test_ordinals
 
 tags TAGS: FORCE
        rm -f TAGS tags