github.com/release-engineering/exodus-rsync@v1.11.2/test/symver-check (about) 1 #!/bin/bash 2 # A test script to ensure portability of exodus-rsync binary. 3 # 4 # If exodus-rsync is built on a platform with a sufficiently new glibc, 5 # it'll end up dynamically linked against versioned symbols not available 6 # on older versions, making the binary not portable to older distributions. 7 # This script aims to detect such situations, and exits with a non-zero 8 # exit code if found. 9 set -e 10 set -o pipefail 11 12 # glibc 2.12 is the version on RHEL6 13 GLIBC2_MAXVER=12 14 15 SUBJECT=exodus-rsync 16 17 glibc_symvers_present(){ 18 nm -uD $SUBJECT | { egrep --only-matching 'GLIBC_2\.[0-9.]+' || :; } | sort | uniq 19 } 20 21 check_glibc_symver(){ 22 # Get minor component only 23 ver=$(echo $1 | sed -r -e 's|^GLIBC_2\.([0-9]+).*|\1|') 24 ver_ok=$(expr $ver '<=' $GLIBC2_MAXVER || :) 25 26 if test $ver_ok != 1; then 27 echo "ERROR: $SUBJECT is linked against too new glibc symbols:" 1>&2 28 # Output the symbols to make it clearer 29 nm -uD $SUBJECT | fgrep "GLIBC_2.$ver" 1>&2 30 exit 5 31 fi 32 } 33 34 glibc_symvers_present | while read symver; do 35 check_glibc_symver $symver 36 done