[Nix-dev] eval $buildPhase and exit code in case of syntax error

Eelco Dolstra e.dolstra at tudelft.nl
Fri Oct 17 09:35:48 CEST 2008


Hi,

Marc Weber wrote:

> I've spend a some time today debugging a mistake..
> I didn't see a syntax error within my phase :-(
> 
> The problem:
> 
> eval "{" returns exit code 0 !
> 
> fail || eval "{" does so as well.
> 
> The only solution to make this a failure I've found is doing something
> awkward such as:
> 
> myEval(){
>         local evalSucc="failure"
>         eval "evalSucc=ok;""$1"
>         [ $evalSucc = "failure" ] && return 1
> }
> 
> So does someone mind me replacing the eval found in setup-new by this
> one?
> Is there a good point in time to add this because it would cause rebuild
> of everything..
> 
> Do we have setup-new to add where I can add it?

It could be done in the stdenv-branch.

However, this really looks like a bug in bash.  Preferably this would be fixed
upstream rather than putting in hacks to work around bash bugs.

BTW, this isn't the only place where bash silently ignores errors (even with
"-e" active).  For instance, errors from subshells (e.g. "(cd /foo)") are ignored.

-- 
Eelco Dolstra | http://www.st.ewi.tudelft.nl/~dolstra/



More information about the nix-dev mailing list