Gentoo Archives: gentoo-commits

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 09 Sep 2019 08:22:17
Message-Id: 1568016627.a3880bcae6b796a9662e7a394edb68ae9c9762c2.ulm@gentoo
1 commit: a3880bcae6b796a9662e7a394edb68ae9c9762c2
2 Author: Ulrich Müller <ulm <AT> gentoo <DOT> org>
3 AuthorDate: Mon Sep 2 13:48:58 2019 +0000
4 Commit: Ulrich Müller <ulm <AT> gentoo <DOT> org>
5 CommitDate: Mon Sep 9 08:10:27 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3880bca
7
8 bzr.eclass: Respect the EVCS_UMASK variable.
9
10 Bug: https://bugs.gentoo.org/497798
11 Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>
12
13 eclass/bzr.eclass | 22 ++++++++++++++++++++--
14 1 file changed, 20 insertions(+), 2 deletions(-)
15
16 diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
17 index 10bd6bc7e5a..598a0f87fe6 100644
18 --- a/eclass/bzr.eclass
19 +++ b/eclass/bzr.eclass
20 @@ -140,6 +140,17 @@ EXPORT_FUNCTIONS src_unpack
21 # by users.
22 : ${EBZR_OFFLINE=${EVCS_OFFLINE}}
23
24 +# @ECLASS-VARIABLE: EVCS_UMASK
25 +# @DEFAULT_UNSET
26 +# @DESCRIPTION:
27 +# Set this variable to a custom umask. This is intended to be set by
28 +# users. By setting this to something like 002, it can make life easier
29 +# for people who do development as non-root (but are in the portage
30 +# group), and then switch over to building with FEATURES=userpriv.
31 +# Or vice-versa. Shouldn't be a security issue here as anyone who has
32 +# portage group write access already can screw the system over in more
33 +# creative ways.
34 +
35 # @ECLASS-VARIABLE: EBZR_WORKDIR_CHECKOUT
36 # @DEFAULT_UNSET
37 # @DESCRIPTION:
38 @@ -197,7 +208,7 @@ bzr_update() {
39 # working copy.
40 bzr_fetch() {
41 local repo_dir branch_dir
42 - local save_sandbox_write=${SANDBOX_WRITE}
43 + local save_sandbox_write=${SANDBOX_WRITE} save_umask
44
45 [[ -n ${EBZR_REPO_URI} ]] || die "${EBZR}: EBZR_REPO_URI is empty"
46
47 @@ -214,6 +225,10 @@ bzr_fetch() {
48 repo_dir=${EBZR_STORE_DIR}/${EBZR_PROJECT}
49 branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}}
50
51 + if [[ -n ${EVCS_UMASK} ]]; then
52 + save_umask=$(umask)
53 + umask "${EVCS_UMASK}" || die
54 + fi
55 addwrite "${EBZR_STORE_DIR}"
56
57 if [[ ! -d ${branch_dir}/.bzr ]]; then
58 @@ -240,8 +255,11 @@ bzr_fetch() {
59 bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
60 fi
61
62 - # Restore sandbox environment
63 + # Restore sandbox environment and umask
64 SANDBOX_WRITE=${save_sandbox_write}
65 + if [[ -n ${save_umask} ]]; then
66 + umask "${save_umask}" || die
67 + fi
68
69 cd "${branch_dir}" || die "${EBZR}: can't chdir to ${branch_dir}"