From patchwork Fri Jun 12 00:40:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Langlois X-Patchwork-Id: 1689 Return-Path: Delivered-To: patchwork@archlinux.org Received: from apollo.archlinux.org (localhost [127.0.0.1]) by apollo.archlinux.org (Postfix) with ESMTP id F03E519512743 for ; Fri, 12 Jun 2020 00:41:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on apollo.archlinux.org X-Spam-Level: * X-Spam-Status: No, score=1.8 required=5.0 tests=DKIM_INVALID=1,DKIM_SIGNED=0.1, FROM_SUSPICIOUS_NTLD=0.499,LOCAL_CHARITY=1.5,MAILING_LIST_MULTI=-1, PDS_OTHER_BAD_TLD=1.999,RCVD_IN_DNSWL_MED=-2.3,RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,SPF_HELO_NONE=0.001 autolearn=no autolearn_force=no version=3.4.4 X-Spam-BL-Results: [127.0.0.19] [127.0.9.2] [127.0.0.11] Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by apollo.archlinux.org (Postfix) with ESMTPS for ; Fri, 12 Jun 2020 00:41:04 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id DB3091CC1B897A; Fri, 12 Jun 2020 00:41:00 +0000 (UTC) Received: from luna.archlinux.org (luna.archlinux.org [5.9.250.164]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: luna) by orion.archlinux.org (Postfix) with ESMTPSA id 7E27F1CC1B8973; Fri, 12 Jun 2020 00:41:00 +0000 (UTC) Authentication-Results: orion.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=langlois.xyz header.i=eric@langlois.xyz header.b=DG8Pwl9d Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 6107429CC1; Fri, 12 Jun 2020 00:41:00 +0000 (UTC) Authentication-Results: luna.archlinux.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=langlois.xyz header.i=eric@langlois.xyz header.b=DG8Pwl9d Received: from luna.archlinux.org (luna.archlinux.org [127.0.0.1]) by luna.archlinux.org (Postfix) with ESMTP id 23B4529CC0 for ; Fri, 12 Jun 2020 00:41:00 +0000 (UTC) Received: from orion.archlinux.org (orion.archlinux.org [88.198.91.70]) by luna.archlinux.org (Postfix) with ESMTPS for ; Fri, 12 Jun 2020 00:41:00 +0000 (UTC) Received: from orion.archlinux.org (localhost [127.0.0.1]) by orion.archlinux.org (Postfix) with ESMTP id C5EC71CC1B8971 for ; Fri, 12 Jun 2020 00:40:58 +0000 (UTC) Received: from sender4-of-o51.zoho.com (sender4-of-o51.zoho.com [136.143.188.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by orion.archlinux.org (Postfix) with ESMTPS for ; Fri, 12 Jun 2020 00:40:58 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1591922455; cv=none; d=zohomail.com; s=zohoarc; b=SLAsOqfvCWg6FqwC1NmDpLQrZ38BWU9now0dHQ55DC6swITobwBHGvIlv2XuLIH6KnoI92fjY6q4oXMqtJxgyn8qyxP3PbMo7BFaKr8EAYrYCG0UFG4cjJBkt9Ux7MpNArKn4nRahyzM/GZm5BrJvYHWs0MVJ94ZVwdenh3qruo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591922455; h=Content-Type:Date:From:MIME-Version:Message-ID:Subject:To; bh=AADiwDLD5TrSw0YZy0M4/6Uf+vQjqmfk6tQyaFU8iaA=; b=m2ywgjvEkrgZYVLJ3T/+oN7jcBD9v7/aY1vyfOVnlAvNlwPwpx3335l704GjuZ4Nm6Eey7s887mG+73tz5bXjcu6B+FIZytw6+1i2fB+Zabxpvz8FwmRvttdjC2Fyv7WX1LOtSAqVxJsIlPZRUUFuxRYxr2S1n16ZOQo0CjS+A0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=langlois.xyz; spf=pass smtp.mailfrom=eric@langlois.xyz; dmarc=pass header.from= header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1591922455; s=zoho; d=langlois.xyz; i=eric@langlois.xyz; h=From:Subject:To:Message-ID:Date:MIME-Version:Content-Type; bh=AADiwDLD5TrSw0YZy0M4/6Uf+vQjqmfk6tQyaFU8iaA=; b=DG8Pwl9d3rz3KO6n4gAYLq6eEr1biCcsrgjOL0akuy0XB4MX9nLoq0RdvY/XFIVq lxzhDEs4MONiDzx1nrGbxIEjR/l0POu4MnL4G/lsVdzfGjtNtXFuROMq2fID3H/ftF2 uJ2yny/qPKRpySdEvUwQJvw2xzSmXAu4X5iagQos= Received: from [192.168.2.54] (mankon0402w-grc-05-184-146-171-106.dsl.bell.ca [184.146.171.106]) by mx.zohomail.com with SMTPS id 1591922454344336.2662764308968; Thu, 11 Jun 2020 17:40:54 -0700 (PDT) From: Eric Langlois To: arch-projects@archlinux.org Message-ID: Date: Thu, 11 Jun 2020 20:40:53 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 Content-Language: en-CA X-Zoho-Virus-Status: 1 X-ZohoMailClient: External Subject: [arch-projects] [namcap] Bugfix for shebangdepends checking with symlink script path X-BeenThere: arch-projects@archlinux.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Arch Linux projects development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Arch Linux projects development discussion Errors-To: arch-projects-bounces@archlinux.org Sender: "arch-projects" 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 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