Ver código fonte

CPack/RPM: Quote paths in rpm spec only if they have whitespace

RPM supports either whitespace with quoting or globbing without quoting.
Prior to RPM 4.19 it accepted globbing in quotes, but it only globbed
correctly without whitespace, where quoting was not necessary anyway.
Starting in RPM 4.19, glob characters in quotes are considered literal.

Fixes: #25421
Inspired-by: Ben Boeckel <[email protected]>
See: https://github.com/rpm-software-management/rpm/commit/d44114f007f54f205ffa13d22724199fe50a137a
Brad King 2 anos atrás
pai
commit
bf22ac5263
1 arquivos alterados com 6 adições e 1 exclusões
  1. 6 1
      Modules/Internal/CPack/CPackRPM.cmake

+ 6 - 1
Modules/Internal/CPack/CPackRPM.cmake

@@ -55,7 +55,12 @@ macro(set_spec_scripts PACKAGE_NAME)
 endmacro()
 endmacro()
 
 
 function(make_rpm_spec_path var path)
 function(make_rpm_spec_path var path)
-  set("${var}" "\"${path}\"" PARENT_SCOPE)
+  # RPM supports either whitespace with quoting or globbing without quoting.
+  if(path MATCHES "[ \t]")
+    set("${var}" "\"${path}\"" PARENT_SCOPE)
+  else()
+    set("${var}" "${path}" PARENT_SCOPE)
+  endif()
 endfunction()
 endfunction()
 
 
 function(get_file_permissions FILE RETURN_VAR)
 function(get_file_permissions FILE RETURN_VAR)