Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: Ulrich Mueller <ulm@g.o>
Cc: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH] git-r3.eclass: respect EVCS_UMASK
Date: Sun, 01 Feb 2015 22:23:41
Message-Id: 20150201232327.0b880692@pomiot
In Reply to: [gentoo-dev] [PATCH] git-r3.eclass: respect EVCS_UMASK by Ulrich Mueller
1 Dnia 2015-02-01, o godz. 23:18:01
2 Ulrich Mueller <ulm@g.o> napisał(a):
3
4 > @@ -309,8 +320,14 @@ _git-r3_set_gitdir() {
5 >
6 > addwrite "${EGIT3_STORE_DIR}"
7 > if [[ ! -d ${GIT_DIR} ]]; then
8 > + local restore_umask=":"
9 > + if [[ ${EVCS_UMASK} ]]; then
10 > + restore_umask=$(umask -p)
11
12 I think that -p is GNU-ism.
13
14 > + umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}"
15 > + fi
16 > mkdir "${GIT_DIR}" || die
17 > git init --bare || die
18 > + ${restore_umask} || die
19
20 And this has ugly implicit pattern expansion. Don't do such things.
21 Ever. Even if you want to split commands.
22
23 And before anyone suggests that, I asked ulm not to use
24 eumask_push/pop. If you ask why, read the eutils code and you'll
25 understand.
26
27 > fi
28 > }
29 >
30 > @@ -508,6 +525,11 @@ git-r3_fetch() {
31 >
32 > # try to fetch from the remote
33 > local r success
34 > + local restore_umask=":"
35 > + if [[ ${EVCS_UMASK} ]]; then
36 > + restore_umask=$(umask -p)
37 > + umask "${EVCS_UMASK}" || die "Bad options to umask: ${EVCS_UMASK}"
38 > + fi
39 > for r in "${repos[@]}"; do
40 > einfo "Fetching ${r} ..."
41 >
42 > @@ -668,6 +690,7 @@ git-r3_fetch() {
43 > break
44 > fi
45 > done
46 > + ${restore_umask} || die
47 > [[ ${success} ]] || die "Unable to fetch from any of EGIT_REPO_URI"
48 >
49 > # submodules can reference commits in any branch
50
51
52
53 --
54 Best regards,
55 Michał Górny

Replies

Subject Author
Re: [gentoo-dev] [PATCH] git-r3.eclass: respect EVCS_UMASK Ulrich Mueller <ulm@g.o>