* Re: [gentoo-dev] Nested die error
2005-04-14 21:42 [gentoo-dev] Nested die error Caleb Tennis
@ 2005-04-14 21:50 ` Stefan Schweizer
2005-04-14 23:56 ` [gentoo-dev] " Michael Sterrett -Mr. Bones.-
2005-04-14 21:54 ` [gentoo-dev] " Stephen Bennett
` (3 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Stefan Schweizer @ 2005-04-14 21:50 UTC (permalink / raw
To: gentoo-dev
if useq blah; then
emake foo || die "emake foo failed"
fi
we use useq because it does not output blah.
regards,
Stefan
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:42 [gentoo-dev] Nested die error Caleb Tennis
2005-04-14 21:50 ` Stefan Schweizer
@ 2005-04-14 21:54 ` Stephen Bennett
2005-04-14 21:58 ` Caleb Tennis
2005-04-14 21:57 ` Olivier Crête
` (2 subsequent siblings)
4 siblings, 1 reply; 11+ messages in thread
From: Stephen Bennett @ 2005-04-14 21:54 UTC (permalink / raw
To: gentoo-dev
On Thu, 2005-04-14 at 16:42 -0500, Caleb Tennis wrote:
> So it seems repoman doesn't like nested die calls like this:
>
> use blah && ( emake foo || die )
>
Yep, because that doesn't work.
> What's the trick? Wrap the emake in a if/then call?
Yes.
> Ignore repoman at the
> risk of potential finger breakage by mr_bones'?
Well, you can as long as you don't mind your ebuild not working. :)
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:54 ` [gentoo-dev] " Stephen Bennett
@ 2005-04-14 21:58 ` Caleb Tennis
2005-04-15 3:17 ` Mike Frysinger
0 siblings, 1 reply; 11+ messages in thread
From: Caleb Tennis @ 2005-04-14 21:58 UTC (permalink / raw
To: gentoo-dev
On Thursday 14 April 2005 04:54 pm, Stephen Bennett wrote:
> > use blah && ( emake foo || die )
>
> Yep, because that doesn't work.
Wow. I've been doing it for years. What's broken about it, the nested die ro
the "use blah &&" part?
Caleb
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:58 ` Caleb Tennis
@ 2005-04-15 3:17 ` Mike Frysinger
0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2005-04-15 3:17 UTC (permalink / raw
To: gentoo-dev
On Thursday 14 April 2005 05:58 pm, Caleb Tennis wrote:
> On Thursday 14 April 2005 04:54 pm, Stephen Bennett wrote:
> > > use blah && ( emake foo || die )
> >
> > Yep, because that doesn't work.
>
> Wow. I've been doing it for years. What's broken about it, the nested die
> ro the "use blah &&" part?
as hinted elsewhere, the problem is that ( ) spawns a subshell ... that means
the call to 'die' aborts the sub (i.e. forked) shell, not the parent (i.e.
the ebuild) shell ... so when emake fails, portage wont notice
-mike
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:42 [gentoo-dev] Nested die error Caleb Tennis
2005-04-14 21:50 ` Stefan Schweizer
2005-04-14 21:54 ` [gentoo-dev] " Stephen Bennett
@ 2005-04-14 21:57 ` Olivier Crête
2005-04-15 3:20 ` Mike Frysinger
2005-04-14 21:59 ` Ciaran McCreesh
2005-04-14 22:05 ` Vibhav Garg
4 siblings, 1 reply; 11+ messages in thread
From: Olivier Crête @ 2005-04-14 21:57 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 706 bytes --]
On Thu, 2005-14-04 at 16:42 -0500, Caleb Tennis wrote:
> So it seems repoman doesn't like nested die calls like this:
>
> use blah && ( emake foo || die )
>
>
> But, without the parenthesis
>
> use blah && emake foo || die
>
> always dies (the emake functions just fine, but it returns an error once emake
> is completed).
>
> What's the trick? Wrap the emake in a if/then call? Ignore repoman at the
> risk of potential finger breakage by mr_bones'?
You can do if/then/fi or
use blah && { emake foo || die; }
{} will not spawn a sub-shell... just execute them in the same shell so
the die will work properly
--
Olivier Crête
tester@gentoo.org
x86 Security Liaison
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:57 ` Olivier Crête
@ 2005-04-15 3:20 ` Mike Frysinger
0 siblings, 0 replies; 11+ messages in thread
From: Mike Frysinger @ 2005-04-15 3:20 UTC (permalink / raw
To: gentoo-dev
On Thursday 14 April 2005 05:57 pm, Olivier Crête wrote:
> You can do if/then/fi or
> use blah && { emake foo || die; }
>
> {} will not spawn a sub-shell... just execute them in the same shell so
> the die will work properly
both syntaxes are ugly imho but the best thing would be to use if/then/fi
because many more developers understand that than the 1 line { } code
-mike
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:42 [gentoo-dev] Nested die error Caleb Tennis
` (2 preceding siblings ...)
2005-04-14 21:57 ` Olivier Crête
@ 2005-04-14 21:59 ` Ciaran McCreesh
2005-04-14 22:05 ` Vibhav Garg
4 siblings, 0 replies; 11+ messages in thread
From: Ciaran McCreesh @ 2005-04-14 21:59 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]
On Thu, 14 Apr 2005 16:42:22 -0500 Caleb Tennis <caleb@gentoo.org>
wrote:
| use blah && ( emake foo || die )
Here's what The Doc will have to say about this:
``die`` and Subshells
---------------------
.. Warning:: ``die`` **will not work in a subshell**.
The following code will not work as expected, since the ``die`` is
inside a subshell: ::
[[ -f foorc ]] && ( update_foorc || die "couldn't update foorc" )
The correct way to rewrite this is to use an ``if`` block: ::
if [[ -f foorc ]] ; then
update_foorc || die "couldn't update foorc"
fi
When using pipes, a subshell is introduced, so the following is unsafe:
::
cat list | while read file ; do epatch ${file} ; done
Using input redirection (see `Abuse of cat`_) avoids this problem: ::
while read file ; do epatch ${file} ; done < list
--
Ciaran McCreesh : Gentoo Developer (Vim, Fluxbox, shell tools)
Mail : ciaranm at gentoo.org
Web : http://dev.gentoo.org/~ciaranm
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [gentoo-dev] Nested die error
2005-04-14 21:42 [gentoo-dev] Nested die error Caleb Tennis
` (3 preceding siblings ...)
2005-04-14 21:59 ` Ciaran McCreesh
@ 2005-04-14 22:05 ` Vibhav Garg
2005-04-14 22:11 ` Ciaran McCreesh
4 siblings, 1 reply; 11+ messages in thread
From: Vibhav Garg @ 2005-04-14 22:05 UTC (permalink / raw
To: gentoo-dev
Caleb Tennis wrote:
>So it seems repoman doesn't like nested die calls like this:
>
>use blah && ( emake foo || die )
>
>
>
i believe this is a question in the developer end quiz too:-)
>But, without the parenthesis
>
>use blah && emake foo || die
>
>always dies (the emake functions just fine, but it returns an error once emake
>is completed).
>
>What's the trick? Wrap the emake in a if/then call? Ignore repoman at the
>risk of potential finger breakage by mr_bones'?
>
>--
>gentoo-dev@gentoo.org mailing list
>
>
>
>
--
gentoo-dev@gentoo.org mailing list
^ permalink raw reply [flat|nested] 11+ messages in thread