]>
Commit | Line | Data |
---|---|---|
95cdc7ab MT |
1 | #!/bin/bash |
2 | ||
3 | . $(dirname ${0})/qa-include | |
4 | ||
5 | # Check for absolute symlinks. | |
6 | # We do not allow them because they may point to any bad location. | |
7 | ||
8 | log_debug "Search for absolute symlinks" | |
9 | ||
10 | function check() { | |
11 | local failed=0 | |
e337df8a | 12 | local item |
95cdc7ab MT |
13 | |
14 | for link in $(find ${BUILDROOT} -type l); do | |
15 | if fgrep -q "/lib/udev/devices" <<<${link}; then | |
16 | continue | |
17 | fi | |
18 | ||
e337df8a MT |
19 | if listmatch "${link:${#BUILDROOT}}" ${QUALITY_AGENT_WHITELIST_SYMLINK}; then |
20 | log INFO "Symlink ${link} is on the whitelist." | |
21 | continue | |
22 | fi | |
23 | ||
95cdc7ab MT |
24 | destination=$(readlink ${link}) |
25 | if [ "${destination:0:1}" = "/" ]; then | |
26 | log ERROR " Absolute symlink: ${link}" | |
27 | failed=1 | |
28 | fi | |
29 | if [ ! -e "${link%/*}/${destination}" ]; then | |
30 | log ERROR " Not existant destination: ${link} -> ${destination}" | |
31 | failed=1 | |
32 | fi | |
33 | done | |
34 | ||
35 | return ${failed} | |
36 | } | |
37 | ||
38 | run | |
39 |