Skip to content

Commit

Permalink
[vcpkg] Fix handling of macho file paths containing regex special cha…
Browse files Browse the repository at this point in the history
…racters.
  • Loading branch information
derekcyruschow-catapult committed Jul 26, 2024
1 parent 3a96876 commit 3989ffc
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions scripts/cmake/z_vcpkg_fixup_rpath_macho.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ function(z_vcpkg_fixup_macho_rpath_in_dir)
continue()
endif()

string(REGEX REPLACE "${macho_file}:\n" "" get_id_ov "${get_id_ov}")
# Escape regex special characters
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${macho_file}")
string(REGEX REPLACE "${regex}:\n" "" get_id_ov "${get_id_ov}")
string(REGEX REPLACE "\n.*" "" get_id_ov "${get_id_ov}")
list(APPEND adjusted_shared_lib_old_ids "${get_id_ov}")
list(APPEND adjusted_shared_lib_new_ids "${macho_new_id}")
Expand Down Expand Up @@ -189,7 +191,8 @@ function(z_vcpkg_fixup_macho_rpath_in_dir)
endif()
foreach(i RANGE ${last_adjusted_index})
list(GET adjusted_shared_lib_old_ids ${i} adjusted_old_id)
if(NOT get_deps_ov MATCHES "[ \t]${adjusted_old_id} ")
string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" regex "${adjusted_old_id}")
if(NOT get_deps_ov MATCHES "[ \t]${regex} ")
continue()
endif()
list(GET adjusted_shared_lib_new_ids ${i} adjusted_new_id)
Expand Down

0 comments on commit 3989ffc

Please sign in to comment.