From 0aaa1298a08f898318916661f2317b2e755206e6 Mon Sep 17 00:00:00 2001 From: Ryan Ofsky Date: Thu, 25 Jul 2024 21:22:00 -0400 Subject: [PATCH] contrib: fix check-deps.sh when libraries do not import symbols Script was failing when called on libraries that do not import symbols, because bash pipefail option was specified, and grep was used in some pipelines to filter symbols, and grep returns status 1 when it doesn't match any lines. This could cause the script to fail on some systems and configurations, such as the clang-tidy CI configuration https://cirrus-ci.com/task/4801670352207872?logs=ci#L6191 where the libbitcoin_crypto_x86_shani.a library does not import symbols. --- contrib/devtools/check-deps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/devtools/check-deps.sh b/contrib/devtools/check-deps.sh index d3a76f0751..3bd48b444a 100755 --- a/contrib/devtools/check-deps.sh +++ b/contrib/devtools/check-deps.sh @@ -75,8 +75,8 @@ extract_symbols() { local temp_dir="$1" for lib in "${!LIBS[@]}"; do for lib_path in ${LIBS[$lib]}; do - nm -o "$lib_path" | grep ' T \| W ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_exports.txt" - nm -o "$lib_path" | grep ' U ' | awk '{print $3, $1}' >> "${temp_dir}/${lib}_imports.txt" + nm -o "$lib_path" | { grep ' T \| W ' || true; } | awk '{print $3, $1}' >> "${temp_dir}/${lib}_exports.txt" + nm -o "$lib_path" | { grep ' U ' || true; } | awk '{print $3, $1}' >> "${temp_dir}/${lib}_imports.txt" awk '{print $1}' "${temp_dir}/${lib}_exports.txt" | sort -u > "${temp_dir}/${lib}_exported_symbols.txt" awk '{print $1}' "${temp_dir}/${lib}_imports.txt" | sort -u > "${temp_dir}/${lib}_imported_symbols.txt" done