Use checkbashisms for init.d scripts, bug #439490
authorZac Medico <zmedico@gentoo.org>
Thu, 25 Oct 2012 03:21:41 +0000 (20:21 -0700)
committerZac Medico <zmedico@gentoo.org>
Thu, 25 Oct 2012 03:21:41 +0000 (20:21 -0700)
bin/misc-functions.sh

index 9b280588cf2f9443c039dd1f74b4abf006a6837f..db023e48a90857e7a5759f1052380fff9bdee050 100755 (executable)
@@ -558,6 +558,23 @@ install_qa_check() {
                done
        done
 
+       local checkbashisms=$(type -P checkbashisms)
+       if [[ -n ${checkbashisms} ]] ; then
+               for d in /etc/init.d ; do
+                       [[ -d ${ED}${d} ]] || continue
+                       for i in "${ED}${d}"/* ; do
+                               [[ -e ${i} ]] || continue
+                               [[ -L ${i} ]] && continue
+                               f=$("${checkbashisms}" -f "${i}" 2>&1)
+                               [[ $? != 0 && -n ${f} ]] || continue
+                               eqawarn "QA Notice: shell script appears to use non-POSIX feature(s):"
+                               while read -r ;
+                                       do eqawarn "   ${REPLY}"
+                               done <<< "${f//${ED}}"
+                       done
+               done
+       fi
+
        # Look for leaking LDFLAGS into pkg-config files
        f=$(egrep -sH '^Libs.*-Wl,(-O[012]|--hash-style)' "${ED}"/usr/*/pkgconfig/*.pc)
        if [[ -n ${f} ]] ; then