summaryrefslogtreecommitdiffstats
path: root/Modules/Internal
diff options
context:
space:
mode:
authorHarry Mallon <hjmallon@gmail.com>2019-02-22 11:58:42 (GMT)
committerBrad King <brad.king@kitware.com>2019-02-25 14:46:19 (GMT)
commitd3ffe90598da9c9439cc9a42012c0bef05ad25f7 (patch)
treeadde1f21ccbb08c7d597076c0fc332b2fbab57bd /Modules/Internal
parent63928f0868ae48f0b21464b466a0f8bc7b8e3369 (diff)
downloadCMake-d3ffe90598da9c9439cc9a42012c0bef05ad25f7.zip
CMake-d3ffe90598da9c9439cc9a42012c0bef05ad25f7.tar.gz
CMake-d3ffe90598da9c9439cc9a42012c0bef05ad25f7.tar.bz2
CPackRPM: Fix packaging in folders with ++ in name
Construct a regex that can match a path with special characters instead of treating the path as a regex directly. Fixes: #18967
Diffstat (limited to 'Modules/Internal')
-rw-r--r--Modules/Internal/CPack/CPackRPM.cmake9
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake
index 2de71ee..26b2517 100644
--- a/Modules/Internal/CPack/CPackRPM.cmake
+++ b/Modules/Internal/CPack/CPackRPM.cmake
@@ -63,6 +63,11 @@ function(get_unix_permissions_octal_notation PERMISSIONS_VAR RETURN_VAR)
set(${RETURN_VAR} "${OWNER_PERMISSIONS}${GROUP_PERMISSIONS}${WORLD_PERMISSIONS}" PARENT_SCOPE)
endfunction()
+function(cpack_rpm_exact_regex regex_var string)
+ string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${string}")
+ set("${regex_var}" "${regex}" PARENT_SCOPE)
+endfunction()
+
function(cpack_rpm_prepare_relocation_paths)
# set appropriate prefix, remove possible trailing slash and convert backslashes to slashes
if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_PREFIX)
@@ -482,7 +487,9 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE
# recalculate path length after conversion to canonical form
string(LENGTH "${SYMLINK_POINT_}" SYMLINK_POINT_LENGTH_)
- if(SYMLINK_POINT_ MATCHES "${WDIR}/.*")
+ cpack_rpm_exact_regex(IN_SYMLINK_POINT_REGEX "${WDIR}")
+ string(APPEND IN_SYMLINK_POINT_REGEX "/.*")
+ if(SYMLINK_POINT_ MATCHES "${IN_SYMLINK_POINT_REGEX}")
# only symlinks that are pointing inside the packaging structure should be checked for relocation
string(SUBSTRING "${SYMLINK_POINT_}" ${WDR_LEN_} -1 SYMLINK_POINT_WD_)
cpack_rpm_symlink_get_relocation_prefixes("${F}" "${PACKAGE_PREFIXES}" "SYMLINK_RELOCATIONS")