Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Fix error handling for custom build scripts #100

Open
Artoria2e5 opened this issue Nov 25, 2017 · 6 comments
Open

Fix error handling for custom build scripts #100

Artoria2e5 opened this issue Nov 25, 2017 · 6 comments

Comments

@Artoria2e5
Copy link
Contributor

Artoria2e5 commented Nov 25, 2017

Our current error handling for sourced scripts involve testing what is returned from the script itself. For predefined build scripts this works well because we have many return-on-error hooks, but things go wild with poorly-written (read: every single one of) autobuild/build scripts.

We can either fix all the scripts, or at least partially switch to some "strict mode" handling by set -ueE and trap something ERR. (Hell, I don't even like how .() messes up scopes in the first place.) It is, however, still important to note that set -e does not properly handle lines with && and/or ||. And I also have no idea about how to re-enter the script from an error handler.

@LionNatsu
Copy link
Contributor

@Artoria2e5
Copy link
Contributor Author

@LionNatsu
Copy link
Contributor

LionNatsu commented Jun 16, 2018

https://github.com/AOSC-Dev/autobuild3/blob/d146b34acfd90ad1b02579c47c6c4e306523c245/proc/50-build_exec.sh#L27

Looks good, but why do ABTYPE=self never exit when errors occur?

For example, autobuild/build:

false
echo It should not be here

Is it because set -e cannot work properly in this scope?

@Artoria2e5
Copy link
Contributor Author

We have a set -e ???????

@LionNatsu
Copy link
Contributor

arch_loadfile_strict have.

@Artoria2e5
Copy link
Contributor Author

It's probably the || thing that is breaking set -e here. Perhaps it should be rewritten into an explicit if (($?)); then ...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants