Gentoo Archives: gentoo-dev

From: Peter Stuge <peter@×××××.se>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Early idea: install_qa_check() refactor and 'public API'
Date: Sat, 13 Sep 2014 17:15:43
Message-Id: 20140913171532.422.qmail@stuge.se
In Reply to: [gentoo-dev] Early idea: install_qa_check() refactor and 'public API' by "Michał Górny"
1 Michał Górny wrote:
2 > ( source "${f}" || die "sourcing ${f} failed" )
3 >
4 > 2b. Unless someone knows a way around this, this means that the check
5 > -- unless 'die'-fatal -- needs to ensure non-zero status of last
6 > comment, likely via some trailing 'true' or ':'. Since we can't
7 > distinguish between non-zero return from script and non-zero exit
8 > due to syntax error or so.
9
10 Just a nit that the subshell needs to exit 0, not non-zero. 0 is
11 success, non-zero is error.
12
13 The calling could be expanded and there could be a contract about
14 different exit codes meaning different things. Since "we" control
15 both sides of this contract it's not limited to a binary result.
16
17
18 > 3b. We really do want to legalize die in subshells. We can't live
19 > without it anyway, so why pretending it's illegal?
20
21 Why would it be? If something is a fatal error then it is a fatal
22 error. I guess one reason might be that die should only be called in
23 the top level, but that's also easy enough.. Just exit 1 instead of
24 die within the subshell.
25
26
27 > What do you think?
28
29 I like it.
30
31
32 //Peter