]> git.ipfire.org Git - ipfire-3.x.git/commitdiff
QA: Check for absolute symlinks.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Feb 2010 14:25:24 +0000 (15:25 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 14 Feb 2010 14:25:24 +0000 (15:25 +0100)
tools/quality-agent.d/002-bad-symlinks [new file with mode: 0755]

diff --git a/tools/quality-agent.d/002-bad-symlinks b/tools/quality-agent.d/002-bad-symlinks
new file mode 100755 (executable)
index 0000000..f42dbde
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+. $(dirname ${0})/qa-include
+
+# Check for absolute symlinks.
+# We do not allow them because they may point to any bad location.
+
+log "Search for absolute symlinks"
+
+failed=0
+for link in $(find ${BUILDROOT} -type l); do
+       destination=$(readlink ${link})
+       if [ "${destination:0:1}" = "/" ]; then
+               log "  absolute symlink: ${link}"
+               failed=1
+       fi
+done
+
+exit ${failed}