Mailing List Archive

EAPI 3 and "nonfatal die"
In EAPI 3, most commands and functions provided by the package
manager automatically call die if they fail. There's also a
new "nonfatal" function that can be used to suppress this
behaviour: by prefixing a function/command call with nonfatal,
the automatic die behaviour is suppressed during the executation
of that function/command.

The difficulty here is that it's not clear what nonfatal should
do to explicit die and assert calls. On the one hand, if
nonfatal does suppress these functions, then nonfatal can be
usefully used with eclass functions - silly hypothetical example:

# eclass
escons() {
scons "${@}" || die "scons failed"
}

# ebuild
nonfatal escons || do_something_else

On the other hand, it could be risky to change the behaviour of
existing functions like that:

do_foo() {
cd foo || die "cd failed"
# something that would be dangerous if run in some other directory
}

If called as "nonfatal do_foo" and the cd failed, do_foo
/wouldn't/ return a failure code - it would proceed with the rest
of its body and wreak all manner of havoc.

One way around this would be to add either an option to die to
explicitly tell it to respect nonfatal, or an alternative die
function. This would allow eclasses to choose to respect
nonfatal when it's safe to do so, but without changing existing
behaviour. The disadvantage of this is that it would require
changes to all eclass functions that could potentially use it,
plus the slight ugliness of making them handle older EAPIs as
well.

Another option would be to make die respect nonfatal by default,
and add an option that doesn't. This wouldn't require changes to
eclasses that want the nonfatal behaviour, but it would require
some care to make sure that it was used when necessary. A
potential advantage of this over the previous solution is that if
the "force" option is implemented with an environment variable,
it can be used regardless of EAPI - the previous example could be
changed to something like

do_foo() {
cd foo || DIE_FORCE=1 die "cd failed"
# something that would be dangerous if run in some other directory
}

Does anyone have any opinions on which of the four options (#1
make die respect nonfatal, #2 make die always die, #3 add a new
die variant that respects nonfatal, #4 make regular die respect
nonfatal, and add a new variant that doesn't) we should go with?
We should definitely get this resolved and agreed on before EAPI
3 is finalised.
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Friday 21 of August 2009 22:56:41 David Leverton wrote:
> Does anyone have any opinions on which of the four options (#1
> make die respect nonfatal, #2 make die always die, #3 add a new
> die variant that respects nonfatal, #4 make regular die respect
> nonfatal, and add a new variant that doesn't) we should go with?
> We should definitely get this resolved and agreed on before EAPI
> 3 is finalised.

I suggest #5 - drop the idea of 'nonfatal'.

Quoting devmanual:
"The die function should be used to indicate a fatal error and abort the
build. Its parameters should be the message to display."
Period.
In such case, following code:

nonfatal some_function

when:
some_function() {
so_sth || die "sth failed"
}

only means, that "some_function" shouldn't have been equipped with 'die'
mechanism, as use case appeared that demands it being non-fatal.
And in this case "some_function" should be fixed to be nonfatal instead (and
all existing invocations suffixed by "|| die".
Simple as this.
Please refrain from adding silly workarounds like this - only thing they add
is unnecessary complexity and thus maintenance/debugging burden.

--
regards
MM
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Fri, 21 Aug 2009 23:09:33 +0200
Maciej Mrozowski <reavertm@poczta.fm> wrote:
> I suggest #5 - drop the idea of 'nonfatal'.

Then how do you plan to handle all the standard utilities that die on
failure in EAPI 3?

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Friday 21 August 2009 21:56:41 David Leverton wrote:
> A potential advantage of this over the previous solution is that if
> the "force" option is implemented with an environment variable,
> it can be used regardless of EAPI

...except that the previous solution could use an environment variable too, of
course.
Re: EAPI 3 and "nonfatal die" [ In reply to ]
2009-08-21 22:56:41 David Leverton napisał(a):
> In EAPI 3, most commands and functions provided by the package
> manager automatically call die if they fail. There's also a
> new "nonfatal" function that can be used to suppress this
> behaviour: by prefixing a function/command call with nonfatal,
> the automatic die behaviour is suppressed during the executation
> of that function/command.
>
> The difficulty here is that it's not clear what nonfatal should
> do to explicit die and assert calls. On the one hand, if
> nonfatal does suppress these functions, then nonfatal can be
> usefully used with eclass functions - silly hypothetical example:
>
> # eclass
> escons() {
> scons "${@}" || die "scons failed"
> }
>
> # ebuild
> nonfatal escons || do_something_else
>
> On the other hand, it could be risky to change the behaviour of
> existing functions like that:
>
> do_foo() {
> cd foo || die "cd failed"
> # something that would be dangerous if run in some other directory
> }
>
> If called as "nonfatal do_foo" and the cd failed, do_foo
> /wouldn't/ return a failure code - it would proceed with the rest
> of its body and wreak all manner of havoc.
>
> One way around this would be to add either an option to die to
> explicitly tell it to respect nonfatal, or an alternative die
> function. This would allow eclasses to choose to respect
> nonfatal when it's safe to do so, but without changing existing
> behaviour. The disadvantage of this is that it would require
> changes to all eclass functions that could potentially use it,
> plus the slight ugliness of making them handle older EAPIs as
> well.
>
> Another option would be to make die respect nonfatal by default,
> and add an option that doesn't. This wouldn't require changes to
> eclasses that want the nonfatal behaviour, but it would require
> some care to make sure that it was used when necessary. A
> potential advantage of this over the previous solution is that if
> the "force" option is implemented with an environment variable,
> it can be used regardless of EAPI - the previous example could be
> changed to something like
>
> do_foo() {
> cd foo || DIE_FORCE=1 die "cd failed"
> # something that would be dangerous if run in some other directory
> }
>
> Does anyone have any opinions on which of the four options (#1
> make die respect nonfatal, #2 make die always die, #3 add a new
> die variant that respects nonfatal, #4 make regular die respect
> nonfatal, and add a new variant that doesn't) we should go with?

I think that 'DIE_FORCE=1 die "${die_message}"' (which was invented by me) would be the
best option. It will allow to use nonfatal() with eclass functions with the smallest
number of required changes in eclasses.

I would like to also notice that (not yet approved by Council) definition of nonfatal()
in PMS was recently drastically changed without proper discussion with developers of
other package managers. [1] was sent about 20 minutes after discussion about nonfatal()
started in #gentoo-portage in about 2009-08-06 19:45 UTC.
(I'm attaching IRC log from #gentoo-portage (in UTC+02 timezone).)
I think that such drastic changes should be first discussed on gentoo-dev mailing list.

[1] http://archives.gentoo.org/gentoo-pms/msg_5ae501394eaeff148cfc349f84d960c9.xml

--
Arfrever Frehtes Taifersar Arahesis
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Sat, 22 Aug 2009 00:40:04 +0200
Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> I would like to also notice that (not yet approved by Council)
> definition of nonfatal() in PMS was recently drastically changed
> without proper discussion with developers of other package managers.
> [1] was sent about 20 minutes after discussion about nonfatal()
> started in #gentoo-portage in about 2009-08-06 19:45 UTC. (I'm
> attaching IRC log from #gentoo-portage (in UTC+02 timezone).) I think
> that such drastic changes should be first discussed on gentoo-dev
> mailing list.

There was no change to the definition of nonfatal. There was a
clarification of the wording after it became clear that there was room
to misinterpret the intent of the original wording, and it went through
the usual Council-mandated process for such a change.

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Friday 21 of August 2009 23:12:23 Ciaran McCreesh wrote:
> On Fri, 21 Aug 2009 23:09:33 +0200

> Maciej Mrozowski <reavertm@poczta.fm> wrote:
> > I suggest #5 - drop the idea of 'nonfatal'.

> Then how do you plan to handle all the standard utilities that die on
> failure in EAPI 3?

>>> #1 make die respect nonfatal
The most obvious. About consequences - when you override behaviour of "die-on-
failure" function (that has been marked as fatal for reason) you're supposed
to know what you're doing, so all codepaths should be checked in that case,
otherwise one should be really ready to grab the pieces in such case.

>>> #2 make die always die
In such case nonfatal is useless as it's supposed to surpass "die-on-failure"
EAPI3 functions, am I right?
Correct me if I'm wrong, bug there are just two ways to mark function
invocation as 'failed':
- return nonzero value - soft way
- abort further execution of script, so call die function - hard way

In such case nonfatal works against its purpose (it cannot interfere in
arbitrary function's flow control, and return value only affects this, so the
only mean for it is to interfere in general-purpose-die-function).
This could be fixed by introducing 'even-more-fatal' way of aborting script
execution, like function 'really-die-seriously-this-time' that ignores
'nonfatal' :P (which leads us to #3 and #4).

>>> #3 add a new die variant that respects nonfatal
Seems the most reasonable to me, but should be introduced with caution (if at
all). It's very old question how to approach flow control: whether to:
- maintain in using 'do_it_now_think_later' approach (exceptions' handling,
nonfatal)
- 'do_it_now_think_now' (checking return values)
Ideally would be to have just one.
And if the goal is to implement exception-handling-like (actually catching and
ignoring) approach in flow control for EAPI3 instead of relying on return
value (|| die) with runtime errors throwing (current 'die'), one would need
not just one or two "die functions", but maybe whole family, with different
fatality levels (for example controlled by environment variable, so that one
could ignore those with level > 0 or could be more strict and only ignore
those with level > 2, when 0 would be the most fatal, 1 less-lethal and so
on).

>>> #4 make regular die respect nonfatal, and add a new variant that doesn't)
we should go with?
All existing 'die' invocations now are supposed to be fatal (according to
definition in devmanual), so making them maybe-fatal in EAPI3 is wrong imho.

General problem is defining what's really fatal and what's not - and I can
assure that someone in a future will find some use case for preventing
aborting of execution of some fatal function that failed.

That being said I don't like refraining from "return value approach" towards
"exception handling approach" (and I'm ebuild/eclass developer and I don't see
adding || die very disturbing) that has been proposed for EAPI3 in die-on-
failure utility functions, and thus I don't like nonfatal (which is of course
needed for them).

--
regards
MM
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Sat, 22 Aug 2009 01:01:48 +0200
Maciej Mrozowski <reavertm@poczta.fm> wrote:
> That being said I don't like refraining from "return value approach"
> towards "exception handling approach"

nonfatal's not an exception handling approach. Think of it as a utility
like 'nice', 'ionice', 'xargs', 'env' or 'hilite'.

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
2009-08-22 00:51:14 Ciaran McCreesh napisał(a):
> On Sat, 22 Aug 2009 00:40:04 +0200
> Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > I would like to also notice that (not yet approved by Council)
> > definition of nonfatal() in PMS was recently drastically changed
> > without proper discussion with developers of other package managers.
> > [1] was sent about 20 minutes after discussion about nonfatal()
> > started in #gentoo-portage in about 2009-08-06 19:45 UTC. (I'm
> > attaching IRC log from #gentoo-portage (in UTC+02 timezone).) I think
> > that such drastic changes should be first discussed on gentoo-dev
> > mailing list.
>
> There was no change to the definition of nonfatal.

There was a change regardless of what you think.

> There was a clarification of the wording after it became clear that there
> was room to misinterpret the intent of the original wording, and it went
> through the usual Council-mandated process for such a change.

This sentence contradicts your first sentence. Additionally you had deceived
Christian Faulhammer by not presenting negative consequences of your patch and
your interpretation of original wording of definition of nonfatal().

--
Arfrever Frehtes Taifersar Arahesis
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Saturday 22 of August 2009 01:06:30 Ciaran McCreesh wrote:
> On Sat, 22 Aug 2009 01:01:48 +0200
>
> Maciej Mrozowski <reavertm@poczta.fm> wrote:
> > That being said I don't like refraining from "return value approach"
> > towards "exception handling approach"
>
> nonfatal's not an exception handling approach. Think of it as a utility
> like 'nice', 'ionice', 'xargs', 'env' or 'hilite'.

Le sigh..
Replacing return value with die ("throw") *and* providing 'nonfatal' as
mechanism to catch and ignore what's been thrown is obviously "exception
handling approach" (not literally that is, I don't have to recall the
semantics of \" character) - every respected software engineer will see that.

But on topic, if you want to participate in discussion, please refer to
suggestions given by David, please.

--
regards
MM
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Sat, 22 Aug 2009 01:20:36 +0200
Maciej Mrozowski <reavertm@poczta.fm> wrote:
> > > That being said I don't like refraining from "return value
> > > approach" towards "exception handling approach"
> >
> > nonfatal's not an exception handling approach. Think of it as a
> > utility like 'nice', 'ionice', 'xargs', 'env' or 'hilite'.
>
> Le sigh..
> Replacing return value with die ("throw") *and* providing 'nonfatal'
> as mechanism to catch and ignore what's been thrown is obviously
> "exception handling approach" (not literally that is, I don't have to
> recall the semantics of \" character) - every respected software
> engineer will see that.

That isn't what nonfatal does. It does not in any way catch and ignore
what's been thrown. It prevents the fatal notification from being sent
in the first place.

die is not a throw operation, never has been a throw operation (see the
whole "die in subshells" mess) and isn't going to be a throw operation.

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Sat, 22 Aug 2009 01:15:18 +0200
Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > There was no change to the definition of nonfatal.
>
> There was a change regardless of what you think.

No, you were misreading the original wording (which I quite happy
admit was wide open for misreading), hence the need for the
clarification.

> > There was a clarification of the wording after it became clear that
> > there was room to misinterpret the intent of the original wording,
> > and it went through the usual Council-mandated process for such a
> > change.
>
> This sentence contradicts your first sentence.

No, it doesn't.

The original wording used the phrase "abort the build process due to a
failure". The intent was that this would cover commands that had
language like "Failure behaviour is EAPI dependent as per
section~\ref{sec:failure-behaviour}.".

The language for 'die' does not say "due to a failure", and so was not
supposed to be affected by 'nonfatal'.

However, that wasn't explicit, so your misreading of the intent of the
document is entirely understandable. That is why we fixed it.

> Additionally you had deceived Christian Faulhammer by not presenting
> negative consequences of your patch and your interpretation of
> original wording of definition of nonfatal().

The only consequence of the patch was to clarify what was already
stated.

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
2009-08-22 01:28:17 Ciaran McCreesh napisał(a):
> On Sat, 22 Aug 2009 01:15:18 +0200
> Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > > There was no change to the definition of nonfatal.
> >
> > There was a change regardless of what you think.
>
> No, you were misreading the original wording

The original wording didn't disallow affecting die(). Not disallowed things
are always allowed.

> > > There was a clarification of the wording after it became clear that
> > > there was room to misinterpret the intent of the original wording,
> > > and it went through the usual Council-mandated process for such a
> > > change.
> >
> > This sentence contradicts your first sentence.
>
> No, it doesn't.

"it went through the usual Council-mandated process for such a change" clearly
contradicts "There was no change".

> The original wording used the phrase "abort the build process due to a
> failure". The intent was that this would cover commands that had
> language like "Failure behaviour is EAPI dependent as per
> section~\ref{sec:failure-behaviour}.".
>
> The language for 'die' does not say "due to a failure", and so was not
> supposed to be affected by 'nonfatal'.
>
> However, that wasn't explicit, so your misreading of the intent of the
> document is entirely understandable. That is why we fixed it.

You broke it.

> > Additionally you had deceived Christian Faulhammer by not presenting
> > negative consequences of your patch and your interpretation of
> > original wording of definition of nonfatal().
>
> The only consequence of the patch was to clarify what was already
> stated.

It wasn't stated as I said above in my 2 first sentences in this e-mail.

--
Arfrever Frehtes Taifersar Arahesis
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Sat, 22 Aug 2009 01:39:41 +0200
Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > > There was a change regardless of what you think.
> >
> > No, you were misreading the original wording
>
> The original wording didn't disallow affecting die(). Not disallowed
> things are always allowed.

Er, no. The wording describes the extent of what die and nonfatal do.
There's nothing in the die description about it being affected by
nonfatal, and nothing in the nonfatal description about affecting die,
so neither affect each other.

PMS doesn't say "nonfatal must not chmod +s ${D}/bin/sh", so do you
believe that nonfatal would be allowed to do that too?

> > > > There was a clarification of the wording after it became clear
> > > > that there was room to misinterpret the intent of the original
> > > > wording, and it went through the usual Council-mandated process
> > > > for such a change.
> > >
> > > This sentence contradicts your first sentence.
> >
> > No, it doesn't.
>
> "it went through the usual Council-mandated process for such a
> change" clearly contradicts "There was no change".

There was a change in wording to better convey the original intent.
There was no change in behaviour.

> > The original wording used the phrase "abort the build process due
> > to a failure". The intent was that this would cover commands that
> > had language like "Failure behaviour is EAPI dependent as per
> > section~\ref{sec:failure-behaviour}.".
> >
> > The language for 'die' does not say "due to a failure", and so was
> > not supposed to be affected by 'nonfatal'.
> >
> > However, that wasn't explicit, so your misreading of the intent of
> > the document is entirely understandable. That is why we fixed it.
>
> You broke it.

I made the wording more clearly present the original intent. That is
all.

> > > Additionally you had deceived Christian Faulhammer by not
> > > presenting negative consequences of your patch and your
> > > interpretation of original wording of definition of nonfatal().
> >
> > The only consequence of the patch was to clarify what was already
> > stated.
>
> It wasn't stated as I said above in my 2 first sentences in this
> e-mail.

It was. The extent of the behaviour of nonfatal is described in PMS.
You can't go around inventing magic new behaviour for it that isn't
specified.

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Fri, 21 Aug 2009 21:56:41 +0100
David Leverton <levertond@googlemail.com> wrote:

> Does anyone have any opinions on which of the four options (#1
> make die respect nonfatal, #2 make die always die, #3 add a new
> die variant that respects nonfatal, #4 make regular die respect
> nonfatal, and add a new variant that doesn't) we should go with?
> We should definitely get this resolved and agreed on before EAPI
> 3 is finalised.

I'd like die to respect nonfatal. People using nonfatal should check
beforehand that the functions they're calling won't do anything stupid if
die's are ignored. If there's something that absolutely has to die, nonfatal
or not, then use a variable. I guess that's #4?


--
fonts, Character is what you are in the dark.
gcc-porting,
wxwidgets @ gentoo EFFD 380E 047A 4B51 D2BD C64F 8AA8 8346 F9A4 0662
Re: EAPI 3 and "nonfatal die" [ In reply to ]
2009-08-22 01:43:54 Ciaran McCreesh napisał(a):
> On Sat, 22 Aug 2009 01:39:41 +0200
> Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > > > > There was a clarification of the wording after it became clear
> > > > > that there was room to misinterpret the intent of the original
> > > > > wording, and it went through the usual Council-mandated process
> > > > > for such a change.
> > > >
> > > > This sentence contradicts your first sentence.
> > >
> > > No, it doesn't.
> >
> > "it went through the usual Council-mandated process for such a
> > change" clearly contradicts "There was no change".
>
> There was a change in wording to better convey the original intent.
> There was no change in behaviour.

There was a change in behavior of 'nonfatal eclass_function_which_sometimes_calls_die'.

--
Arfrever Frehtes Taifersar Arahesis
Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Sun, 23 Aug 2009 04:48:56 +0200
Arfrever Frehtes Taifersar Arahesis <Arfrever@gentoo.org> wrote:
> > There was a change in wording to better convey the original intent.
> > There was no change in behaviour.
>
> There was a change in behavior of 'nonfatal
> eclass_function_which_sometimes_calls_die'.

No there wasn't. The behaviour specified by PMS both before and after
the patch remains exactly the same. The only thing the patch did was
make the wording much clearer, so people can no longer make the
(perfectly understandble) misinterpretation of the intent that you have
made.

--
Ciaran McCreesh
Re: EAPI 3 and "nonfatal die" [ In reply to ]
Hi,

Ryan Hill <dirtyepic@gentoo.org>:

> On Fri, 21 Aug 2009 21:56:41 +0100
> David Leverton <levertond@googlemail.com> wrote:
>
> > Does anyone have any opinions on which of the four options (#1
> > make die respect nonfatal, #2 make die always die, #3 add a new
> > die variant that respects nonfatal, #4 make regular die respect
> > nonfatal, and add a new variant that doesn't) we should go with?
> > We should definitely get this resolved and agreed on before EAPI
> > 3 is finalised.
>
> I'd like die to respect nonfatal. People using nonfatal should check
> beforehand that the functions they're calling won't do anything
> stupid if die's are ignored. If there's something that absolutely
> has to die, nonfatal or not, then use a variable. I guess that's #4?

I agree here (yes, I know, a "ME TOO" posting, but I say this as PMS
team member).

V-Li

--
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode

<URL:http://gentoo.faulhammer.org/>
Re: Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Mon, Aug 24, 2009 at 08:20:44PM +0200, Christian Faulhammer wrote:
> Hi,
>
> Ryan Hill <dirtyepic@gentoo.org>:
>
> > On Fri, 21 Aug 2009 21:56:41 +0100
> > David Leverton <levertond@googlemail.com> wrote:
> >
> > > Does anyone have any opinions on which of the four options (#1
> > > make die respect nonfatal, #2 make die always die, #3 add a new
> > > die variant that respects nonfatal, #4 make regular die respect
> > > nonfatal, and add a new variant that doesn't) we should go with?
> > > We should definitely get this resolved and agreed on before EAPI
> > > 3 is finalised.
> >
> > I'd like die to respect nonfatal. People using nonfatal should check
> > beforehand that the functions they're calling won't do anything
> > stupid if die's are ignored. If there's something that absolutely
> > has to die, nonfatal or not, then use a variable. I guess that's #4?
>
> I agree here (yes, I know, a "ME TOO" posting, but I say this as PMS
> team member).

I must agree here too as a PMS team member. so 'me too' :P

--
---------
Thomas Anderson
Gentoo Developer
/////////
Areas of responsibility:
AMD64, Secretary to the Gentoo Council
---------
Re: Re: EAPI 3 and "nonfatal die" [ In reply to ]
Ryan Hill wrote:
> On Fri, 21 Aug 2009 21:56:41 +0100
> David Leverton <levertond@googlemail.com> wrote:
>
>> Does anyone have any opinions on which of the four options (#1
>> make die respect nonfatal, #2 make die always die, #3 add a new
>> die variant that respects nonfatal, #4 make regular die respect
>> nonfatal, and add a new variant that doesn't) we should go with?
>> We should definitely get this resolved and agreed on before EAPI
>> 3 is finalised.
>
> I'd like die to respect nonfatal. People using nonfatal should check
> beforehand that the functions they're calling won't do anything stupid if
> die's are ignored.

If you're doing that then it might be wise to add an 'assert' helper
that is guaranteed to generate an exception regardless of 'nonfatal'
status.
--
Thanks,
Zac
Re: Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Mon, 24 Aug 2009 15:09:52 -0700
Zac Medico <zmedico@gentoo.org> wrote:
> > I'd like die to respect nonfatal. People using nonfatal should
> > check beforehand that the functions they're calling won't do
> > anything stupid if die's are ignored.
>
> If you're doing that then it might be wise to add an 'assert' helper
> that is guaranteed to generate an exception regardless of 'nonfatal'
> status.

Probably not the best choice of name... 'assert' is already in use for
checking PIPESTATUS.

The other problem with doing things that way is that people have to
start writing code that does an EAPI check just to be able to force a
die. An IGNORE_NONFATAL environment variable, whilst slightly ickier,
avoids that issue if we do change the definitions of die and nonfatal.

*shrug* I still think the way it was originally worded is the best
option. Otherwise we'll just replace the "some helpers die, some don't,
and no-one knows which" situation with "some eclass functions are
nonfatal aware, some aren't, and no-one knows which", with an added
side helping of "people need to find out whether any of the callers in
any overlay anywhere expect this function to work with nonfatal before
changing it".

--
Ciaran McCreesh
Re: Re: EAPI 3 and "nonfatal die" [ In reply to ]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Christian Faulhammer wrote:
> Hi,
>
> Ryan Hill <dirtyepic@gentoo.org>:
>
>> On Fri, 21 Aug 2009 21:56:41 +0100
>> David Leverton <levertond@googlemail.com> wrote:
>>
>>> Does anyone have any opinions on which of the four options (#1
>>> make die respect nonfatal, #2 make die always die, #3 add a new
>>> die variant that respects nonfatal, #4 make regular die respect
>>> nonfatal, and add a new variant that doesn't) we should go with?
>>> We should definitely get this resolved and agreed on before EAPI
>>> 3 is finalised.
>> I'd like die to respect nonfatal. People using nonfatal should check
>> beforehand that the functions they're calling won't do anything
>> stupid if die's are ignored. If there's something that absolutely
>> has to die, nonfatal or not, then use a variable. I guess that's #4?
>
> I agree here (yes, I know, a "ME TOO" posting, but I say this as PMS
> team member).

I thought the whole idea was that functions that don't currently die by default
because sometimes this is unwanted will now die by default but provide an opt
out --non-fatal switch to get back the old behavior. In the non-fatal case such
functions should then again (as in the current situation) not call die.

Some functions will not have a --non-fatal switch.
Some functions should not have a --non-fatal switch.
Some functions will call die unconditionally.

What is the reason that we are trying to generalize non-fatal from a simple
switch to a full-blown primitive that should handle whatever it's thrown?

Marijn

- --
If you cannot read my mind, then listen to what I say.

Marijn Schouten (hkBst), Gentoo Lisp project, Gentoo ML
<http://www.gentoo.org/proj/en/lisp/>, #gentoo-{lisp,ml} on FreeNode
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkqTuzoACgkQp/VmCx0OL2xh1ACgjvtPz+3uke5p2p+iVuSmGw1u
JKwAn2O2l1h8gRDkGnfZ2aIwaIHvlr/L
=ybPQ
-----END PGP SIGNATURE-----
Re: Re: EAPI 3 and "nonfatal die" [ In reply to ]
On Tue, 25 Aug 2009 12:21:46 +0200
"Marijn Schouten (hkBst)" <hkBst@gentoo.org> wrote:
> What is the reason that we are trying to generalize non-fatal from a
> simple switch to a full-blown primitive that should handle whatever
> it's thrown?

We aren't. nonfatal is done as a prefix rather than a --switch for the
same reason that 'nice' is.

--
Ciaran McCreesh