From f33aef51bec4c08dead2b9502e1b2d42188e290e Mon Sep 17 00:00:00 2001
From: Eric Langlois <eric@langlois.xyz>
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(-)
@@ -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