fix msm-plugin.c svace issue: make sure dupPath is not NULL before strchr()
[platform/upstream/rpm.git] / scripts / check-files
1 #!/bin/sh
2 #
3 # Gets file list on standard input and RPM_BUILD_ROOT as first parameter
4 # and searches for omitted files (not counting directories).
5 # Returns it's output on standard output.
6 #
7 # filon@pld.org.pl
8
9 # Get build root
10 RPM_BUILD_ROOT="${1}"
11
12 # Handle the case where ${RPM_BUILD_ROOT} is undefined, not a directory, etc.
13 if [ ! -d "${RPM_BUILD_ROOT}" ] ; then
14         cat > /dev/null
15         if [ -e "${RPM_BUILD_ROOT}" ] ; then
16                 echo "Error: \`${RPM_BUILD_ROOT}' is not a directory" 1>&2
17         fi
18         exit 1
19 fi
20
21 # Create temporary file listing files in the manifest
22 [ -n "$TMPDIR" ] || TMPDIR="/tmp"
23 FILES_DISK=`mktemp "${TMPDIR}/rpmXXXXXX"`
24
25 # Ensure temporary file is cleaned up when we exit
26 trap "rm -f \"${FILES_DISK}\"" 0 2 3 5 10 13 15
27
28 # Find non-directory files in the build root and compare to the manifest.
29 # TODO: regex chars in last sed(1) expression should be escaped
30 # Exclude /usr/share/info/dir from check-files.
31 find "${RPM_BUILD_ROOT}" -type f -o -type l | LC_ALL=C sort > "${FILES_DISK}"
32 LC_ALL=C sort | diff -d "${FILES_DISK}" - | sed -n -e 's|^< '"${RPM_BUILD_ROOT}"'/usr/share/info/dir$||' -e 's|^< '"${RPM_BUILD_ROOT}"'\(.*\)$|   \1|gp'