Skip to content

Commit bf86869

Browse files
committed
fix(installer): scan ldd output via REGEX MATCHALL instead of line split
string(REPLACE "\n" ";" ...) treats backslash-n as two literal characters in CMake's quoted argument syntax, so the per-line splitter never produced lines and the inner regex never matched. Result: the transitive-dep walker processed each ldd output as a single 'line' and copied nothing. Switch to REGEX MATCHALL across the entire ldd blob, capturing every '=> /path' pair regardless of line boundaries. Verified locally: the bundled lib/ now contains libb2/libpcre2/libzstd/libbrotli/libgssapi/ libkrb5 and ldd reports zero unresolved deps.
1 parent 7c6e8f1 commit bf86869

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

installer/deploy/deploy_linux.cmake

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -174,14 +174,14 @@ install(CODE "
174174
endif()
175175
execute_process(COMMAND ldd \"\${_target}\"
176176
OUTPUT_VARIABLE _ldd_out
177-
ERROR_QUIET
178-
OUTPUT_STRIP_TRAILING_WHITESPACE)
179-
string(REPLACE \"\\n\" \";\" _lines \"\${_ldd_out}\")
180-
foreach(_line IN LISTS _lines)
181-
if(NOT _line MATCHES \"=> *(/[^ ]+)\")
182-
continue()
183-
endif()
184-
set(_path \"\${CMAKE_MATCH_1}\")
177+
ERROR_QUIET)
178+
# Match every '=> /path' pair across the full ldd output.
179+
# CMake's quoted-string \\n is the two characters backslash-n
180+
# (not a newline), so per-line splitting is unreliable; use
181+
# REGEX MATCHALL on the whole blob instead.
182+
string(REGEX MATCHALL \"=> +/[^ \n]+\" _matches \"\${_ldd_out}\")
183+
foreach(_match IN LISTS _matches)
184+
string(REGEX REPLACE \"^=> +\" \"\" _path \"\${_match}\")
185185
get_filename_component(_name \"\${_path}\" NAME)
186186
_is_system_lib(\"\${_name}\" _is_sys)
187187
if(_is_sys)

0 commit comments

Comments
 (0)