File: check_build.sh

package info (click to toggle)
samba 2%3A4.22.3%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,264 kB
  • sloc: ansic: 1,955,394; python: 269,800; sh: 71,598; xml: 50,288; perl: 36,082; makefile: 6,086; yacc: 4,497; exp: 1,582; cpp: 1,224; lex: 989; awk: 589; java: 119; csh: 58; pascal: 54; sed: 45; asm: 30
file content (48 lines) | stat: -rwxr-xr-x 1,384 bytes parent folder | download | duplicates (6)
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
#!/bin/sh -eux
#
# A very simple check script to confirm we still provide binaries
# that look like the targets oss-fuzz wants.
#
# A much stronger check is available in oss-fuzz via
# infra/helper.py check_build samba
#

# oss-fuzz provides an OUT variable, so for clarity this script
# uses the same.  See build_samba.sh
OUT=$1

# build_samba.sh will have put a non-zero number of fuzzers here.  If
# there are none, this will fail as it becomes literally fuzz_*

seeds_found=no

for bin in $OUT/fuzz_*; do
	# we only want to look at the elf files, not the zips
	if [ ${bin%_seed_corpus.zip} != $bin ]; then
		continue
	fi
	# Confirm that the chrpath was reset to lib/ in the same directory
	# as the binary.  RPATH (not RUNPATH) is critical, otherwise
	# libraries used by libraries won't be found on the oss-fuzz
	# target host.
	chrpath -l $bin | grep 'RPATH=$ORIGIN/lib'

	# Confirm that we link to at least some libraries in this
	# directory (shows that the libraries were found and copied).
	ldd $bin | grep "$OUT/lib"
	num_libs=$(ldd $bin | grep -v ld-linux | grep -v linux-vdso | grep -v "$OUT/lib" | wc -l)

	if [ 0$num_libs -ne 0 ]; then
		echo "some libraries not linked to $ORIGIN/lib, oss-fuzz will fail!"
		exit 1
	fi

	if [ -f ${bin}_seed_corpus.zip ]; then
		seeds_found=yes
	fi
done

if [ $seeds_found = no ]; then
	echo "no seed zip files were found!"
	exit 1
fi