Gentoo Archives: gentoo-dev

From: "Alin Năstac" <mrness@g.o>
To: Donnie Berkholz <dberkholz@g.o>
Cc: gentoo-dev@l.g.o
Subject: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in mail-filter/dspam: ChangeLog dspam-3.8.0-r7.ebuild
Date: Mon, 01 Oct 2007 07:23:42
Message-Id: 47009DBA.3010507@gentoo.org
In Reply to: [gentoo-dev] Re: [gentoo-commits] gentoo-x86 commit in mail-filter/dspam: ChangeLog dspam-3.8.0-r7.ebuild by Donnie Berkholz
1 Donnie Berkholz wrote:
2 > On 08:58 Mon 01 Oct , Alin Năstac wrote:
3 >
4 >> According to bash manual, && has a greater precedence than ||. That
5 >> would translate in:
6 >>
7 >
8 > Where'd you see that? Here's my man page:
9 >
10 > A list is a sequence of one or more pipelines separated by one of the
11 > operators ;, &, &&, or ||, and optionally terminated by one of ;, &, or
12 > <newline>.
13 >
14 > Of these list operators, && and || have equal precedence, followed by ;
15 > and &, which have equal precedence.
16 >
17 > Oh, now I see. You're reading about precedence in [[ ]] blocks, which
18 > aren't being used here.
19 >
20 >
21
22 OK, I misread the manual, but even if && and || have same precedence,
23 bash manual says:
24 The control operators && and || denote AND lists and OR lists,
25 respectively. An AND list has the form
26 command1 && command2
27 command2 is executed if, and only if, command1 returns an exit
28 status of zero.
29 An OR list has the form
30 command1 || command2
31 command2 is executed if and only if command1 returns a non-zero
32 exit status. The return status of AND and OR lists is the exit status
33 of the last com-
34 mand executed in the list.
35
36 In this case, $(use mysql || use postgres && use_enable virtual-users)
37 will result in use_enable virtual-users being executed if and only if
38 USE="-mysql postgres". See this pseudocode:
39 if use mysql do nothing
40 else if use postgres
41 use_enable virtual
42
43 Wouldn't be best to die in pkg_setup if USE="virtual-users -mysql
44 -postgres" ?

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies