Hello,

I have a patch that fixes this issue with namcap: https://bugs.archlinux.org/task/66430

To summarize, namcap script dependency checking fails whenever part of the script binary path is a symbolic link because no package provides that exact path. For example, resolving the python path as /usr/sbin/python when running as root. This patch canonicalizes the path first.

- Eric Langlois
>From f33aef51bec4c08dead2b9502e1b2d42188e290e Mon Sep 17 00:00:00 2001
From: Eric Langlois <[email protected]>
Date: Sat, 2 May 2020 18:21:44 -0400
Subject: [PATCH] Use the canonical script path in shebangdepends

This fixes a bug where if the detected script path contains a directory
that is a symbolic link then the path will not appear in the file list
of any package, causing the package detection to falsely report the
script as an orphan.
---
 Namcap/rules/shebangdepends.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Namcap/rules/shebangdepends.py b/Namcap/rules/shebangdepends.py
index 07896df..b684c7e 100644
--- a/Namcap/rules/shebangdepends.py
+++ b/Namcap/rules/shebangdepends.py
@@ -21,6 +21,7 @@
 
 """Checks dependencies on programs specified in shebangs."""
 
+import os
 import shutil
 import Namcap.package
 from Namcap.util import is_script, script_type
@@ -61,7 +62,7 @@ def findowners(scriptlist):
 			continue
 
 		# strip leading slash
-		scriptpath = out.lstrip('/')
+		scriptpath = os.path.realpath(out).lstrip('/')
 		for pkg in Namcap.package.get_installed_packages():
 			pkg_files = [fname for fname, fsize, fmode in pkg.files]
 			if scriptpath in pkg_files:
-- 
2.26.2


Reply via email to