Github messages for voidlinux
 help / color / mirror / Atom feed
From: sgn <sgn@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: [PR PATCH] [Updated] xbps-src: pre-pkg: allow only white-listed directories.
Date: Wed, 20 May 2020 01:12:13 +0200	[thread overview]
Message-ID: <20200519231213.T4UO0H5ORhZqttGcVBElAs80c6DQy-Rk1fSh2HcubN0@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-22035@inbox.vuxu.org>

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

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

https://github.com/sgn/void-packages pkg-lint-allow-only-whitelist
https://github.com/void-linux/void-packages/pull/22035

xbps-src: pre-pkg: allow only white-listed directories.


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

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-pkg-lint-allow-only-whitelist-22035.patch --]
[-- Type: text/x-diff, Size: 2943 bytes --]

From 77745ca88bdce1ecc9fac443dc1a13637e902b11 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx+sgn@gmail.com>
Date: Sun, 17 May 2020 18:42:43 +0700
Subject: [PATCH 1/2] xbps-src: pre-pkg: allow only white-listed directories.

---
 common/hooks/pre-pkg/99-pkglint.sh | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh
index d2c281e39db..498d39ac585 100644
--- a/common/hooks/pre-pkg/99-pkglint.sh
+++ b/common/hooks/pre-pkg/99-pkglint.sh
@@ -21,13 +21,31 @@ hook() {
 		fi
 	done
 	
-	for f in sys dev home root run var/run tmp usr/local destdir; do
+	for f in var/run usr/local; do
 		if [ -d ${PKGDESTDIR}/${f} ]; then
 			msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
 			error=1
 		fi
 	done
 
+	for f in "$PKGDESTDIR"/*; do
+		f="${f##*/}"
+		case "$f" in
+		'*') : empty meta package ;;
+		lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv) ;;
+		INSTALL|REMOVE|rdeps|shlib-requires|shlib-provides)
+			if [ ! -f "${PKGDESTDIR}/$f" ]; then
+				msg_red "${pkgver}: /${f} is not allowed\n"
+				error=1
+			fi
+			;;
+		*)
+			msg_red "${pkgver}: /${f} directory is not allowed, remove it!\n"
+			error=1
+			;;
+		esac
+	done
+
 	# Check that configuration files really exist.
 	for f in $(expand_destdir "${conf_files}"); do
 		if [ ! -f "${PKGDESTDIR}/${f}" ]; then

From 28c4154d8d0b753b5463454bdd0d9ddf4147f1bd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
 <congdanhqx+sgn@gmail.com>
Date: Wed, 20 May 2020 06:12:02 +0700
Subject: [PATCH 2/2] fixup! xbps-src: pre-pkg: allow only white-listed
 directories.

---
 common/hooks/pre-pkg/99-pkglint.sh | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/common/hooks/pre-pkg/99-pkglint.sh b/common/hooks/pre-pkg/99-pkglint.sh
index 498d39ac585..5fcdb664683 100644
--- a/common/hooks/pre-pkg/99-pkglint.sh
+++ b/common/hooks/pre-pkg/99-pkglint.sh
@@ -31,7 +31,12 @@ hook() {
 	for f in "$PKGDESTDIR"/*; do
 		f="${f##*/}"
 		case "$f" in
-		'*') : empty meta package ;;
+		'*')	# Forbid empty packages unless build_style=meta
+			if [ "$build_style" != "meta" ]; then
+				msg_red "${pkgver}: PKGDESTDIR is empty and build_style != meta\n"
+				error=1
+			fi
+			;;
 		lib|bin|sbin|lib64|lib32|usr|var|opt|etc|boot|srv) ;;
 		INSTALL|REMOVE|rdeps|shlib-requires|shlib-provides)
 			if [ ! -f "${PKGDESTDIR}/$f" ]; then
@@ -107,14 +112,6 @@ hook() {
 		fi
 	done
 
-	# Forbid empty packages unless build_style=meta
-	if [ "$build_style" != "meta" ]; then
-		if [ "$(find $PKGDESTDIR/* -maxdepth 1 -type d 2>/dev/null)" = "" ]; then
-			msg_red "${pkgver}: PKGDESTDIR is empty and build_style != meta\n"
-			error=1
-		fi
-	fi
-
 	if [ $error -gt 0 ]; then
 		msg_error "${pkgver}: cannot continue with installation!\n"
 	fi

  parent reply	other threads:[~2020-05-19 23:12 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-17 11:44 [PR PATCH] " sgn
2020-05-17 12:08 ` [PR PATCH] [Updated] " sgn
2020-05-19 22:50 ` sgn
2020-05-19 22:56 ` Chocimier
2020-05-19 23:07 ` [PR PATCH] [Updated] " sgn
2020-05-19 23:12 ` sgn [this message]
2020-05-19 23:12 ` sgn
2020-05-19 23:15 ` jnbr
2020-05-19 23:19 ` q66
2020-05-19 23:23 ` [PR PATCH] [Updated] " sgn
2020-05-19 23:26 ` sgn
2020-05-19 23:27 ` sgn
2020-05-21 15:33 ` [PR PATCH] [Updated] " sgn
2020-05-22 17:35 ` Chocimier
2020-05-23 11:48 ` [PR PATCH] [Updated] " sgn
2020-05-23 11:56 ` sgn
2020-05-31  2:11 ` [PR PATCH] [Merged]: " sgn

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=20200519231213.T4UO0H5ORhZqttGcVBElAs80c6DQy-Rk1fSh2HcubN0@z \
    --to=sgn@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).