Fix Windows packaging step: simplify bash { } | sort -u | while pattern

The previous step used a bash group command piped through sort -u and a
while loop. Under MSYS2 bash + 'set -e -o pipefail' (GitHub Actions
default), this triggered a non-zero exit even when the loop body
succeeded, causing the Windows daemon job to fail at the packaging step
(the actual link of both trianglesd.exe and triangles-cli.exe succeeded).

Replaced the { } | sort -u | while pattern with a temp-file-based dedup:
- ldd both binaries, append to /tmp/cli-dlls.txt (or cli-libs.txt on Linux)
- sort -u the temp file
- pipe the result into the while loop (simpler pipeline, no group)

Also applied the same simplification to the Linux .deb packaging for
consistency, even though the Linux build was passing.
This commit is contained in:
Krystie
2026-06-18 19:19:32 -07:00
parent 569b541931
commit 274aafab36
+12 -11
View File
@@ -284,13 +284,13 @@ jobs:
cp build/bin/trianglesd.exe daemon-dist/
cp build/bin/triangles-cli.exe daemon-dist/
# Copy all linked DLLs from MSYS2 (covers both binaries; ldd union)
{
ldd build/bin/trianglesd.exe | grep '/mingw64' | awk '{print $3}'
ldd build/bin/triangles-cli.exe | grep '/mingw64' | awk '{print $3}'
} | sort -u | while read dll; do
cp "$dll" daemon-dist/ 2>/dev/null || true
# Collect all linked DLLs from MSYS2 (covers both binaries; dedup via sort -u)
ldd build/bin/trianglesd.exe | grep '/mingw64' | awk '{print $3}' > /tmp/cli-dlls.txt
ldd build/bin/triangles-cli.exe | grep '/mingw64' | awk '{print $3}' >> /tmp/cli-dlls.txt
sort -u /tmp/cli-dlls.txt | while read dll; do
[ -n "$dll" ] && cp "$dll" daemon-dist/ 2>/dev/null || true
done
rm -f /tmp/cli-dlls.txt
- name: Bundle Tor for daemon
shell: powershell
@@ -492,11 +492,11 @@ jobs:
[ -d tor-extract/data ] && cp -r tor-extract/data ${PKG}/usr/lib/cryptographic-triangles/tor/data
# Bundle ALL shared library dependencies (except glibc/kernel)
# Union of ldd output from both binaries
{
ldd build/bin/trianglesd | grep '=> /' | awk '{print $3}'
ldd build/bin/triangles-cli | grep '=> /' | awk '{print $3}'
} | sort -u | while read lib; do
# Union of ldd output from both binaries, dedup via sort -u
ldd build/bin/trianglesd | grep '=> /' | awk '{print $3}' > /tmp/cli-libs.txt
ldd build/bin/triangles-cli | grep '=> /' | awk '{print $3}' >> /tmp/cli-libs.txt
sort -u /tmp/cli-libs.txt | while read lib; do
[ -z "$lib" ] && continue
case "$lib" in
/lib/x86_64-linux-gnu/libc.so*|/lib/x86_64-linux-gnu/libm.so*|/lib/x86_64-linux-gnu/libpthread.so*|/lib/x86_64-linux-gnu/libdl.so*|/lib/x86_64-linux-gnu/librt.so*|/lib/x86_64-linux-gnu/ld-linux*|/lib64/ld-linux*)
;; # Skip glibc core — always present
@@ -505,6 +505,7 @@ jobs:
;;
esac
done
rm -f /tmp/cli-libs.txt
echo "=== Bundled libs ==="
ls ${PKG}/usr/lib/cryptographic-triangles/lib/ | wc -l
ls ${PKG}/usr/lib/cryptographic-triangles/lib/