[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#284356: Incompatable ABI checker



Here is a script that I wrote to compare the symbols provided by two
kernel-headers (2.4) packages.  It is just rough at this stage but I
plan to put it into my build process to warn of this kind of problem in
the future.  Please feel free to use/mangle/update at will.

-- 
Horms
#!/bin/bash
######################################################################
# kernel_symbol_check                                    December 2004
# Horms                                             horms@verge.net.au
#
# kernel_symbol_check
# Check the symbols in two kernel-headers Debian packages and
# repot if they do not match and a diff of the symbols.
# Probably only works with 2.4 kernels
#
# Copyright (C) 2004  Horms
#
# 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; either version 2 of the
# License, or (at your option) any later version.
# 
# 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.
# 
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
# 02111-1307  USA
######################################################################

NAME="kernel_symbol_check"

set -e

clean ()
{
	rm -rf "$TMP";
}

TMP="$(mktemp -d)"
trap clean EXIT

if [ $# -ne 2 ]; then
	echo "usage $NAME deb1 deb2" 1>&2
	echo "  where deb1 and deb2 are the full path to " 1>&2
	echo "  (different) 2.4 kernel header packages" 1>&2
	echo 1>&2
	echo "  e.g. $NAME \\" 1>&2
	echo "          kernel-headers-2.4.27-1-686_2.4.27-2_i386.deb \\" 1>&2
	echo "          kernel-headers-2.4.27-1-686_2.4.27-6_i386.deb" 1>&2
	echo 1>&2
	exit 1
fi

PKG1="$1"
PKG2="$2"

PKG1_FILE="${PKG1##*/}"
PKG1_BASE="${PKG1_FILE%%_*}"

PKG2_FILE="${PKG2##*/}"
PKG2_BASE="${PKG2_FILE%%_*}"

rm -rf "$TMP/1/" "$TMP/2/"
mkdir "$TMP/1/" "$TMP/2/"
dpkg -x "$PKG1" "$TMP/1/"
dpkg -x "$PKG2" "$TMP/2/"

find "$TMP/1/usr/src/$PKG1_BASE/include" -name "*.ver" -type f | \
	xargs cat | sort > "$TMP/1.sym"
find "$TMP/2/usr/src/$PKG2_BASE/include" -name "*.ver" -type f | \
	xargs cat | sort > "$TMP/2.sym"

if diff -u "$TMP/1.sym" "$TMP/2.sym"; then
	echo "No Changes"
	STATUS=0
else
	echo '!!!Symbol Changes, as above. Incompatible ABI!!!'
	STATUS=1
fi

exit $STATUS


Reply to: