Github messages for voidlinux
 help / color / mirror / Atom feed
From: Chocimier <Chocimier@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] [RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
Date: Wed, 05 Aug 2020 22:00:34 +0200	[thread overview]
Message-ID: <20200805200034.QB6Nh_jbiZ08t33vuHkWz8Wk3evZtqjZ64ZZ_2afEHA@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-23601@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 538 bytes --]

There is an updated pull request by Chocimier against master on the void-packages repository

https://github.com/Hoshpak/void-packages allow_usr_share_exceptions
https://github.com/void-linux/void-packages/pull/23601

[RFC] 11-pkglint-elf-in-usrshare: allow explicit setting of exceptions
This will allow to explicitely ignore files in the hook where it otherwise would create false positives like in the case of qemu.

@void-linux/pkg-committers

A patch file from https://github.com/void-linux/void-packages/pull/23601.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-allow_usr_share_exceptions-23601.patch --]
[-- Type: text/x-diff, Size: 5756 bytes --]

From 5f6f8c26b8741a1b61d97f54f7a74a6d6c2ec91c Mon Sep 17 00:00:00 2001
From: Helmut Pozimski <helmut@pozimski.eu>
Date: Thu, 16 Jul 2020 19:44:01 +0200
Subject: [PATCH 1/3] 11-pkglint-elf-in-usrshare: allow explicit setting of
 exceptions
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Co-authored-by: Piotr Wójcik <chocimier@tlen.pl>
---
 .../11-pkglint-elf-in-usrshare.sh             | 24 ++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index ff4f7789e86..e586264139b 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,26 +2,44 @@
 #
 # This hook executes the following tasks:
 #   - Looks on all packages for binary files being installed to /usr/share
+#   - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
 
 hook() {
-    local matches mime file
+    local matches mime file f prune_expr dir
 
     if [ ! -d ${PKGDESTDIR}/usr/share ]; then
         return 0
     fi
 
+    if [ "${ignore_elf_dirs}" ]; then
+        for dir in ${ignore_elf_dirs}; do
+            if ! [ "${prune_expr}" ]; then
+                prune_expr="( -path ${PKGDESTDIR}${dir}"
+            else
+                prune_expr+=" -o -path ${PKGDESTDIR}${dir}"
+            fi
+        done
+        prune_expr+=" ) -prune -o "
+    fi
+
     # Find all binaries in /usr/share and add them to the pool
     while read -r f; do
         mime="${f##*:}"
         mime="${mime// /}"
         file="${f%:*}"
+        file="${file#${PKGDESTDIR}}"
         case "${mime}" in
             # Note application/x-executable is missing which is present in most Electron apps
             application/x-sharedlib*|application/x-pie-executable*)
-                matches+=" ${file#$PKGDESTDIR}" ;;
+                if [[ ${ignore_elf_files} != *"${file}"* ]]
+                then
+                    matches+=" ${file}"
+                fi
+                ;;
         esac
-    done < <(find $PKGDESTDIR/usr/share -type f | file --mime-type --files-from -)
+    done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
 
+    # Check passed if no packages in pool
     if [ -z "$matches" ]; then
         return 0
     fi

From 12c261e215833c7b1d72b26051f52a6fd859fd22 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:24:10 +0200
Subject: [PATCH 2/3] 11-pkglint-elf-in-usrshare: check whole noarch packages

---
 .../11-pkglint-elf-in-usrshare.sh             | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index e586264139b..033c033a3de 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -2,12 +2,21 @@
 #
 # This hook executes the following tasks:
 #   - Looks on all packages for binary files being installed to /usr/share
+#   - For noarch packages, looks into /
 #   - Allows exceptions listed in $ignore_elf_dirs and $ignore_elf_files
 
 hook() {
-    local matches mime file f prune_expr dir
+    local matches mime file f prune_expr dir basedir
 
-    if [ ! -d ${PKGDESTDIR}/usr/share ]; then
+    if [ "${archs// /}" = "noarch" ]; then
+        basedir=/
+        found_in="noarch package"
+    else
+        basedir=/usr/share
+        found_in=$basedir
+    fi
+
+    if [ ! -d ${PKGDESTDIR}${basedir} ]; then
         return 0
     fi
 
@@ -22,7 +31,7 @@ hook() {
         prune_expr+=" ) -prune -o "
     fi
 
-    # Find all binaries in /usr/share and add them to the pool
+    # Find all binaries in $basedir and add them to the pool
     while read -r f; do
         mime="${f##*:}"
         mime="${mime// /}"
@@ -37,14 +46,14 @@ hook() {
                 fi
                 ;;
         esac
-    done < <(find $PKGDESTDIR/usr/share $prune_expr -type f | file --mime-type --files-from -)
+    done < <(find ${PKGDESTDIR}${basedir} $prune_expr -type f | file --mime-type --files-from -)
 
     # Check passed if no packages in pool
     if [ -z "$matches" ]; then
         return 0
     fi
 
-    msg_red "${pkgver}: ELF files found in /usr/share:\n"
+    msg_red "${pkgver}: ELF files found in ${found_in}:\n"
     for f in $matches; do
         msg_red "   ${f}\n"
     done

From 7924f919b249455c89dd87bf3591322f7746eb7f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Piotr=20W=C3=B3jcik?= <chocimier@tlen.pl>
Date: Tue, 4 Aug 2020 22:28:14 +0200
Subject: [PATCH 3/3] 11-pkglint-elf-in-usrshare: disallow x-executable

Can be allowed per-package now
---
 common/hooks/post-install/11-pkglint-elf-in-usrshare.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
index 033c033a3de..2c558a90b62 100644
--- a/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
+++ b/common/hooks/post-install/11-pkglint-elf-in-usrshare.sh
@@ -38,8 +38,7 @@ hook() {
         file="${f%:*}"
         file="${file#${PKGDESTDIR}}"
         case "${mime}" in
-            # Note application/x-executable is missing which is present in most Electron apps
-            application/x-sharedlib*|application/x-pie-executable*)
+            application/x-sharedlib*|application/x-pie-executable*|x-executable*)
                 if [[ ${ignore_elf_files} != *"${file}"* ]]
                 then
                     matches+=" ${file}"

  parent reply	other threads:[~2020-08-05 20:00 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 17:46 [PR PATCH] " Hoshpak
2020-07-16 18:29 ` pullmoll
2020-07-16 18:30 ` [PR REVIEW] " ahesford
2020-07-16 19:09 ` [PR PATCH] [Updated] " Hoshpak
2020-07-16 19:18 ` Hoshpak
2020-07-16 19:20 ` Hoshpak
2020-07-16 23:28 ` [PR REVIEW] " Johnnynator
2020-07-16 23:29 ` Johnnynator
2020-07-17 10:56 ` Piraty
2020-07-20 19:27 ` [PR PATCH] [Updated] " Hoshpak
2020-07-20 19:29 ` Hoshpak
2020-07-20 19:31 ` Hoshpak
2020-07-20 19:53 ` ahesford
2020-07-22 22:07 ` Chocimier
2020-07-23 16:34 ` Hoshpak
2020-07-29 20:54 ` Chocimier
2020-07-30 15:07 ` Hoshpak
2020-08-05 20:00 ` [PR PATCH] [Updated] " Chocimier
2020-08-05 20:00 ` Chocimier [this message]
2020-08-05 20:07 ` Chocimier
2020-08-05 20:11 ` [PR PATCH] [Updated] " Chocimier
2020-08-20 17:50 ` Chocimier
2020-08-20 17:50 ` Chocimier
2020-08-20 17:53 ` Chocimier
2020-08-25 19:14 ` [PR PATCH] [Updated] " Chocimier
2020-08-25 19:19 ` [PR PATCH] [Merged]: " Chocimier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200805200034.QB6Nh_jbiZ08t33vuHkWz8Wk3evZtqjZ64ZZ_2afEHA@z \
    --to=chocimier@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).