From e3c1e1fbcbf50d86bdbc6d6cf31ea6c87b1ed407 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 6 Sep 2022 10:24:09 -0400 Subject: [PATCH] Validate RUNPATH of standalone Linux binaries in CI --- TODO | 4 ---- build-scripts/build-appimage | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/TODO b/TODO index 8bb9fcbe..5bf49fe6 100644 --- a/TODO +++ b/TODO @@ -19,10 +19,6 @@ Pending changes: * Consider also exposing a way to set a new logger and to get the logger from QPDF and QPDFJob in the C API. -* Check about runpath in the linux-bin distribution. I think the - appimage build specifically is setting the runpath, which is - actually desirable in this case. Make sure to understand and - document this. Maybe add a check for it in the build. Soon: Break ground on "Document-level work" diff --git a/build-scripts/build-appimage b/build-scripts/build-appimage index 3ba7175e..a9fba23c 100755 --- a/build-scripts/build-appimage +++ b/build-scripts/build-appimage @@ -26,6 +26,13 @@ done version=$(basename distribution/qpdf*AppImage | cut -d- -f 2) ./distribution/qpdf*AppImage --appimage-extract D=$PWD/distribution +if ! (readelf -d squashfs-root/usr/bin/qpdf | \ + grep RUNPATH | grep -q -F ..); then + # We are relying on the AppImage build to create an executable + # whose runpath is relative to the binary so that the extract zip + # file is relocatable. + echo "Standalone linux binary lacks relative RUNPATH" +fi (cd squashfs-root/usr; \ zip -9 --symlinks $D/qpdf-$version-bin-linux-x86_64-ci.zip \ bin/{qpdf,fix-qdf,zlib-flate} lib/*)