Gentoo Archives: gentoo-portage-dev

From: Johannes Fahrenkrug <jfa@××××××.de>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] emerge-webrsync patch
Date: Mon, 23 Jan 2006 11:40:09
Message-Id: 43D4C05A.1040601@gebeco.de
In Reply to: Re: [gentoo-portage-dev] emerge-webrsync patch by Johannes Fahrenkrug
1 Brian,
2
3 did you have a chance to look at this yet?
4
5 - Johannes.
6
7 Johannes Fahrenkrug wrote:
8
9 > Brian Harring wrote:
10 >
11 >> On Wed, Jan 11, 2006 at 10:15:00AM +0100, Johannes Fahrenkrug wrote:
12 >>
13 >>
14 >>> if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then
15 >>>
16 >>
17 >>
18 >> Haven't looked at the patch yet, but a bit of bash fu for ya-
19 >>
20 >> [[ -n $VAR ]] == ! [[ -z $VAR ]]
21 >>
22 >> -z is zero length or unset, -n is length >= 1 (thus must be set).
23 >>
24 >>
25 > Exactly!
26 > This code ...
27 >
28 > If [[ -n $VAR ]] == ! [[ -z $VAR ]] (which it is) then
29 > export WE_ARE_NICED=1
30 > exec nice -n "$PORTAGE_NICENESS" "$0" "$@"
31 > fi
32 >
33 > ...has the purpose to execute the current script again with
34 > nice if PORTAGE_NICENESS is set and WE_ARE_NICED is not set (to avoid
35 > an infinite loop).
36 > Right?
37 >
38 > If...
39 >
40 > if [[ -n $PORTAGE_NICENESS ]] && ! [[ -z $WE_ARE_NICED ]]; then
41 >
42 > ...is the same as...
43 >
44 > if [[ -n $PORTAGE_NICENESS ]] && [[ -n $WE_ARE_NICED ]]; then
45 >
46 > ...then that would mean that the condition is only met when both
47 > PORTAGE_NICENESS
48 > and WE_ARE_NICED are set. But WE_ARE_NICED is only set inside the
49 > if-body. So
50 > I think the condition should read
51 > if [[ -n $PORTAGE_NICENESS ]] && [[ -z $WE_ARE_NICED ]]; then
52 > meaning the condition is only met when PORTAGE_NICENESS is set and
53 > WE_ARE_NICED is NOT set.
54 >
55 > Maybe I'm completely wrong here, but I think that's the only way the
56 > condition makes sense.
57 > Please enlighten me if I'm wrong :)
58 >
59 > - Johannes.
60 >
61 >
62
63
64 --
65 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] emerge-webrsync patch Brian Harring <ferringb@g.o>