/usr/bin/check-symbols is in ubuntu-dev-tools 0.153.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | #!/bin/bash
#
# Copyright (C) 2006-2007 Daniel Holbach <daniel.holbach@ubuntu.com>
# Modified by Siegfried-A. Gevatter <rainct@ubuntu.com>
#
# ##################################################################
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# See file /usr/share/common-licenses/GPL-2 for more details.
#
# ##################################################################
#
# This script is used to get a diff of the exported symbols of all .so files in
# every binary package of package $1.
# Required tools (besides awk, coreutils, grep and sed):
# * apt-cache and apt-get (from apt)
# * diff (from diffutils)
# * dpkg
# * lsb_release (from lsb-release)
# * nm (from binutils)
DISTRO=$(lsb_release -c -s)
DEBLINE=""
DEBUG=False
usage() {
prog=$(basename $0)
cat <<EOF
Usage: $prog [options] source-package [DEBDIR]
Get a diff of the exported symbols of all .so files in every binary package of
package the source package. The source package will be found in DEBDIR, defaulting to /var/cache/pbuilder/result.
Options:
-h, --help show this help message and exit
EOF
exit $1
}
PACKAGE=""
DEBDIR="/var/cache/pbuilder/result"
POSITION=0
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
usage 0
;;
-*)
usage 1
;;
*)
if [ $POSITION -eq 0 ]; then
PACKAGE="$1"
elif [ $POSITION -eq 1 ]; then
DEBDIR="$1"
else
echo "Too many arguments." >&2
usage 1
fi
POSITION=$(($POSITION+1))
esac
shift
done
if [ $POSITION -eq 0 ]; then
echo "Missing argument: source package name." >&2
usage 1
fi
VERSION=$(apt-cache madison "$PACKAGE" | grep -- "$DISTRO"'/.*Sources$' | awk '{print $3}')
PACKAGES=$(apt-cache showsrc "$PACKAGE" | grep-dctrl -s Binary -F Version "$VERSION" | sed 's/Binary\:\ //g;s/\,//g' | sort -u)
if [ `id -u` != "0" ]
then
echo
echo -n "You might now be asked for your password, as this script requires"
echo " sudo privilegies in order to install the packages you want to check."
echo
fi
sudo apt-get install $PACKAGES
echo
for pack in $PACKAGES;
do
for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`
do
LIBNAME=$(basename $lib)
nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.old
done;
DEBLINE="$DEBLINE $DEBDIR/$pack*.deb "
done
if [[ -z $DEBLINE ]]; then
echo "Package doesn't exist: $PACKAGE."
exit 1
fi
NOFILE=True
for filename in $DEBLINE; do
if [[ ${filename: -5} != "*.deb" ]]; then
NOFILE=False
[[ $DEBUG != True ]] || echo "Found binary file: $filename"
fi
done
if [[ $NOFILE == True ]]; then
echo "No matching binary files found in «$DEBDIR»."
exit 1
fi
sudo dpkg -i $DEBLINE;
echo
for pack in $PACKAGES;
do
for lib in `dpkg -L $pack | grep -E "\.so$" | sort -u`
do
LIBNAME=$(basename $lib)
nm -D $lib | cut -d' ' -f3 | sort -u > /tmp/$LIBNAME.new
echo "Checking: $lib"
diff -u /tmp/$LIBNAME.{old,new}
rm /tmp/$LIBNAME.{old,new}
done;
done
|