public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Ulrich Müller" <ulm@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: /, bin/
Date: Wed, 27 Dec 2023 21:18:28 +0000 (UTC)	[thread overview]
Message-ID: <1703689772.cb788dd9acf9f48a9c4934920ebadaa942fe0682.ulm@gentoo> (raw)

commit:     cb788dd9acf9f48a9c4934920ebadaa942fe0682
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Dec 24 10:54:27 2023 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Wed Dec 27 15:09:32 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=cb788dd9

ebuild.sh: Warn about colon-separated argument in sandbox functions

According to PMS and the Devmanual, only a single item is allowed
as argument for addread, addwrite, adddeny and addpredict:
https://projects.gentoo.org/pms/8/pms.html#x1-12300012.3.3
https://devmanual.gentoo.org/function-reference/sandbox-functions/

The previous usage message (contrary to Devmanual policy) had been
added in commit 0c6454261c514f021a4ddce2415a68773027ed6a.

Bug: https://bugs.gentoo.org/920654
Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 NEWS          | 4 ++++
 bin/ebuild.sh | 8 ++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index e1e47d0a2e..40fdfd9ea2 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,10 @@ Features:
 * emerge: depclean now returns with failure if no packages are matched
   (bug #917120)
 
+Bug fixes:
+* addread, addwrite, adddeny, addpredict: Warn about passing a colon-separated
+  list of paths as argument (bug #920654).
+
 portage-3.0.58 (2023-12-14)
 --------------
 

diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index dc8d205f9a..c9f7c04e28 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -162,7 +162,10 @@ fi
 __sb_append_var() {
 	local _v=$1 ; shift
 	local var="SANDBOX_${_v}"
-	[[ -z $1 || -n $2 ]] && die "Usage: add$(LC_ALL=C tr "[:upper:]" "[:lower:]" <<< "${_v}") <colon-delimited list of paths>"
+	[[ $# -eq 1 ]] || die "Usage: add${_v,,} <path>"
+	# Make this fatal after 2024-12-31
+	[[ ${1} == *:* ]] \
+		&& eqawarn "QA Notice: add${_v,,} called with colon-separated argument"
 	export ${var}="${!var:+${!var}:}$1"
 }
 # bash-4 version:
@@ -173,8 +176,9 @@ addwrite()   { __sb_append_var WRITE   "$@" ; }
 adddeny()    { __sb_append_var DENY    "$@" ; }
 addpredict() { __sb_append_var PREDICT "$@" ; }
 
+addread /
+addread "${PORTAGE_TMPDIR}/portage"
 addwrite "${PORTAGE_TMPDIR}/portage"
-addread "/:${PORTAGE_TMPDIR}/portage"
 [[ -n ${PORTAGE_GPG_DIR} ]] && addpredict "${PORTAGE_GPG_DIR}"
 
 # Avoid sandbox violations in temporary directories.


             reply	other threads:[~2023-12-27 21:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-27 21:18 Ulrich Müller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-06-13  2:34 [gentoo-commits] proj/portage:master commit in: /, bin/ Sam James
2023-12-04  6:45 Sam James
2023-05-17  6:20 Sam James
2023-05-01  7:21 Sam James
2022-12-05  4:04 Sam James
2022-09-29 20:45 Sam James
2022-09-29 20:45 Sam James
2022-09-29 20:45 Sam James
2022-09-29 20:45 Sam James
2022-09-29 20:45 Sam James
2022-08-19 17:59 Mike Gilbert
2022-07-18 20:42 Sam James
2020-08-01  1:57 Zac Medico
2017-09-02 21:37 Michał Górny
2014-08-19  7:01 Michał Górny
2014-08-12 21:55 Alexander Berntsen
2012-03-27 15:19 Zac Medico
2012-03-27 14:40 Zac Medico

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=1703689772.cb788dd9acf9f48a9c4934920ebadaa942fe0682.ulm@gentoo \
    --to=ulm@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.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