diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass
index 350e1f83c2..4e8774719b 100644
--- a/meta/classes-global/insane.bbclass
+++ b/meta/classes-global/insane.bbclass
@@ -430,6 +430,7 @@ def package_qa_check_buildpaths(path, name, d, elf):
     explicitly ignored.
     """
     import stat
+    import re
     # Ignore symlinks/devs/fifos
     mode = os.lstat(path).st_mode
     if stat.S_ISLNK(mode) or stat.S_ISBLK(mode) or stat.S_ISFIFO(mode) or stat.S_ISCHR(mode) or stat.S_ISSOCK(mode):
@@ -443,8 +444,10 @@ def package_qa_check_buildpaths(path, name, d, elf):
         if tmpdir in file_content:
             path = package_qa_clean_path(path, d, name)
             oe.qa.handle_error("buildpaths", "File %s in package %s contains reference to TMPDIR" % (path, name), d)
-            buildpaths_skip.append(tmpdir.decode())
-        if homedir and homedir in file_content and not any(path.startswith(homedir.decode()) for path in buildpaths_skip):
+            # If TMPDIR is inside $HOME and this warning fired, so will the one below. Skip that.
+            if tmpdir.startswith(homedir):
+                homedir = b''
+        if homedir and homedir.decode() not in buildpaths_skip and re.search(re.escape(homedir) + b'\\b', file_content):
             path = package_qa_clean_path(path, d, name)
             oe.qa.handle_error("buildpaths", "File %s in package %s contains a reference to the build host HOME directory. If upstream hardcodes a directory path that matches your home, you can set OEQA_BUILDPATHS_SKIP = \"%s\" in the recipe." % (path, name, homedir.decode()), d)
 
