From: "Ulrich Müller" <ulm@gentoo.org>
To: <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] [PATCH] bzr.eclass: Respect the EVCS_UMASK variable.
Date: Mon, 2 Sep 2019 15:48:58 +0200 [thread overview]
Message-ID: <w6gy2z66biw.fsf@kph.uni-mainz.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 2005 bytes --]
Bug: https://bugs.gentoo.org/497798
Signed-off-by: Ulrich Müller <ulm@gentoo.org>
---
eclass/bzr.eclass | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
index 10bd6bc7e5a..598a0f87fe6 100644
--- a/eclass/bzr.eclass
+++ b/eclass/bzr.eclass
@@ -140,6 +140,17 @@ EXPORT_FUNCTIONS src_unpack
# by users.
: ${EBZR_OFFLINE=${EVCS_OFFLINE}}
+# @ECLASS-VARIABLE: EVCS_UMASK
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Set this variable to a custom umask. This is intended to be set by
+# users. By setting this to something like 002, it can make life easier
+# for people who do development as non-root (but are in the portage
+# group), and then switch over to building with FEATURES=userpriv.
+# Or vice-versa. Shouldn't be a security issue here as anyone who has
+# portage group write access already can screw the system over in more
+# creative ways.
+
# @ECLASS-VARIABLE: EBZR_WORKDIR_CHECKOUT
# @DEFAULT_UNSET
# @DESCRIPTION:
@@ -197,7 +208,7 @@ bzr_update() {
# working copy.
bzr_fetch() {
local repo_dir branch_dir
- local save_sandbox_write=${SANDBOX_WRITE}
+ local save_sandbox_write=${SANDBOX_WRITE} save_umask
[[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty"
@@ -214,6 +225,10 @@ bzr_fetch() {
repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT}
branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}}
+ if [[ -n ${EVCS_UMASK} ]]; then
+ save_umask=$(umask)
+ umask "${EVCS_UMASK}" || die
+ fi
addwrite "${EBZR_STORE_DIR}"
if [[ ! -d ${branch_dir}/.bzr ]]; then
@@ -240,8 +255,11 @@ bzr_fetch() {
bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
fi
- # Restore sandbox environment
+ # Restore sandbox environment and umask
SANDBOX_WRITE=${save_sandbox_write}
+ if [[ -n ${save_umask} ]]; then
+ umask "${save_umask}" || die
+ fi
cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}"
--
2.23.0
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]
reply other threads:[~2019-09-02 14:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=w6gy2z66biw.fsf@kph.uni-mainz.de \
--to=ulm@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